XI
I'm not sure from your sample data what you want to do - the sample data doesn't match your explanation. Do you mean that for each row, if column A is not the same as column B, then you would like to shift the cells in columns B & C down one row?
Would like to help but please clarify.
Also, please note that I ran the code that you mentioned from the previous post without any error messages.
Celia
Celia-
Yes sorry I wasn't very clear. I would like to compare A to B and if not the same then move down B and C. The code I am currently using is:
Sub Compare()
Dim cell As Range
Set cell = Range("A1")
Do Until cell = ""
If cell.Offset(-2, 0) <> cell.Offset(-1, 0) Then cell.EntireRow.Insert
Set cell = cell.Offset(2, 0)
Loop
End Sub
I get a Run Time error '1004';
Application Defined or object-defined error
It then highlights the section of code
If cell.Offset(-2, 0) <> cell.Offset(-1, 0) Then
I understand that the code that I am requesting will be a little different then that posted.
Thank You!
X1
Try this :-
Sub Compare()
Dim cell As Range
Set cell = Range("A1")
Do Until cell = ""
If cell <> cell.Offset(0, 1) Then
Range(cell.Offset(0, 1), cell.Offset(0, 2)).Insert Shift:=xlDown
End If
Set cell = cell.Offset(1, 0)
Loop
End Sub
Celia