C
Christine
Hi everyone,
I want to insert a partial row at D1:F1 if A1 <> D1 or B1 <> E1 or C1 <> F1.
I have an error 1004 and I don't know what to do with.
Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4) Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub
Thank you for you help.
Christine
I want to insert a partial row at D1:F1 if A1 <> D1 or B1 <> E1 or C1 <> F1.
I have an error 1004 and I don't know what to do with.
Sub Macro1()
Range("a1").Activate
With Range("a1")
Do Until ActiveCell.Value < 0.01
Cell_1:
If ActiveCell.Offset(0, 0) = ActiveCell.Offset(0, 3) Then
GoTo Cell_2
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_2:
If ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 4) Then
GoTo Cell_3
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert Shift:=xlDown
'error 1004
ActiveCell.Offset(1, -6).Select
Cell_3:
If ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 5)
Then
ActiveCell.Offset(1, 0).Select
Else
.Range(Cells(0, 4), Cells(0, 7)).Insert
Shift:=xlDown 'error 1004
ActiveCell.Offset(1, -6).Select
End If
End If
End If
Loop
End With
End Sub
Thank you for you help.
Christine