View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default IF statement inserting new rows

I just noticed that the insert is before the changed cell, so here is a
modified code to make it after the changed cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(1, 0).Resize(3, 1).EntireRow.Insert
End If
Application.EnableEvents = True
End Sub


"JLGWhiz" wrote in message
...
The code goes into the Sheet code module.


"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