T
TP
I am very new to VBA so any help would much appreciated.
I would like to know how to write a macro that inserts an entire row
of cells everytime the the data in cell b is different from the cell
above it. It would need to be a continuous process until there was no
more data.
eg.
A B
10 40
12 40 < Insert a row between the 40 and 60
17 60
22 60 < Insert a row between the 60 and 70
24 70
29 70
Dim i As Integer
i = 2
While Range("C" & i) <> ""
Do
If Range("C" & i) <> Range("C" & i + 1) Then
Rows(i & ":" & i + 1).Insert Shift:=xlDown
i = i + 1
End If
i = i + 1
Loop
Wend
The above was some code that I came up with but I am pulling my hair
out trying to make it work
Thanks for any help
I would like to know how to write a macro that inserts an entire row
of cells everytime the the data in cell b is different from the cell
above it. It would need to be a continuous process until there was no
more data.
eg.
A B
10 40
12 40 < Insert a row between the 40 and 60
17 60
22 60 < Insert a row between the 60 and 70
24 70
29 70
Dim i As Integer
i = 2
While Range("C" & i) <> ""
Do
If Range("C" & i) <> Range("C" & i + 1) Then
Rows(i & ":" & i + 1).Insert Shift:=xlDown
i = i + 1
End If
i = i + 1
Loop
Wend
The above was some code that I came up with but I am pulling my hair
out trying to make it work
Thanks for any help