Macro building

[Closed]
Report
Posts
3
Registration date
Friday January 13, 2017
Status
Member
Last seen
January 16, 2017
-
I am trying to create a macro that will:
1. Find the cell to the right of where there is an ‘AE’ in column B
2. Copy that cell (example: C1 (2184535300005))
3. Paste in the cells below it until there is an ‘AE’ in column B
4. Repeat with the ‘new number’ (example: C6 (2184536200075))

See the original table and the result I am trying to get!!


Original:
A B C
1 MSA AE 2184535300005
2 ERR PID^1^13^1^2
3 ERR PID^1^3^1^4
4 ERR RXA^1^10^9
5 MSH ^~\& NYSIIS5.4.0
6 MSA AE 2184536200075
7 ERR PID^1^13^1^2
8 ERR PID^1^3^1^4
9 ERR NK1^1^5^1^2
10 ERR NK1^^4^1^7
11 ERR RXA^1^9^1
12 MSH ^~\& NYSIIS5.4.0
13 MSA AE 2184548400001
14 ERR PID^1^13^1^2
15 ERR PID^1^3^1^4
16 ERR RXA^1^10^9
17 ERR OBX^1^17^1^1
18 ERR OBX^1^17^1^3
19 ERR NK1^1^5^1^2
20 MSH ^~\& NYSIIS5.4.0


Result:
A B C
1 MSA AE 2184535300005
2 ERR 2184535300005
3 ERR 2184535300005
4 ERR 2184535300005
5 MSH ^~\& NYSIIS5.4.0
6 MSA AE 2184536200075
7 ERR 2184536200075
8 ERR 2184536200075
9 ERR 2184536200075
10 ERR 2184536200075
11 ERR 2184536200075
12 MSH ^~\& NYSIIS5.4.0
13 MSA AE 2184548400001
14 ERR 2184548400001
15 ERR 2184548400001
16 ERR 2184548400001
17 ERR 2184548400001
18 ERR 2184548400001
19 ERR 2184548400001
20 MSH ^~\& NYSIIS5.4.0