I have a worksheet that is 4 columns by 16331 rows. I want to shift the contents of cells A through C in row n down if the contents of cell C for that row n do not match the contents of cell D for that row n. The contents of column D should never shift. I constructed a for/then/next loop so that the macro will ask whether the contents of cell C row n match the contents of cell D row n for each n until n=16331.
I have pasted an small example below to illustrate an example of what I have (before) and what I would like to accomplish (after).
Here is the macro:
SSub Move_totals_down()
Application.ScreenUpdating = False
Dim r As Long
Dim n As Long
r = Range("C16331").End(xlUp).Row
n = Range("D16331").End(xlUp).Row
For i = 2 To r
For l = 2 To n
If Range("C" & i).Text <> Range("D" & l).Text Then
Cells(r, "A:C").Insert Shift:=xlDown
End If
Next l
Next i
Application.ScreenUpdating = True
End Sub
Nothing happens when I run it. I guess it's better than an error message, but not by much.
Vanessa
Bookmarks