Hi guys,
Please help me with the following code for automatically updating numbers when rows are inserted/deleted. VBA gives me an error on the line:
Range("A & LastCell + 1:A" & Rows.Count) = ""
The code is below...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim StartNum As Long
Dim FirstCell As Long
Dim LastCell As Long
StartNum = 1
FirstCell = 8
LastCell = 357
Application.EnableEvents = False
Do While FirstCell <= LastCell
Range("A" & FirstCell).Value = StartNum
FirstCell = FirstCell + 1
StartNum = StartNum + 1
Loop
Range("A & LastCell + 1:A" & Rows.Count) = ""
Application.EnableEvents = True
End Sub
Why is my synatx wrong. Should I put a .Value after the last bracket? Please take my hand and point me in the right direction.
Thanks
B
Bookmarks