Thread
:
IF statement inserting new rows
View Single Post
#
2
Posted to microsoft.public.excel.programming
Nigel[_3_]
external usenet poster
Posts: 31
IF statement inserting new rows
Sub InsertRows()
Dim lLR As Long, lCR As Long
With Sheets("Sheet1")
lLR = .Cells(Rows.Count, "A").End(xlUp).Row
For lCR = lLR To 1 Step -1
If lCR 1 And lCR < lLR Then
If .Cells(lCR, "A") < .Cells(lCR - 1, "A") Then
Rows(lCR & ":" & lCR + 2).Insert Shift:=xlDown
End If
End If
Next
End With
End Sub
--
Regards,
Nigel
"PVANS" wrote in message
...
Good afternoon everyone
Hope someone can help me with this.
I have a worksheet that is filled rows of information about transactions.
The column A in the worksheet is the date the transaction occured.
I would like to have a macro that notices when there is a change in date,
and then inserts 3 rows below the final transction on the one date, and
the
new transctions of the next date.
I know how to insert a single row using a macro:
Selection.Insert Shift:=x1Down
But I can't seem to figure out how to write the IF statement to compare
the
dates in Column A and insert 3 lines instead of just one.
Would really appreciate the help
Regards,
PVANS
Reply With Quote
Nigel[_3_]
View Public Profile
Find all posts by Nigel[_3_]