Hi, I wrote a macro that is suppposed to add a number to column a when I enter data in column b. I dont want this to be the row number, i just want sequential numbering of these items. I'm not getting any errors....but I'm also not getting any numbers. Can anyone tell me what I'm doing wrong?
Code:
Private Sub AUTO_NUMBER(ByVal Target As Range)
Dim ItemNum
On Error GoTo ERRHANDLER
ItemNum = Value.Target.Offset(-1, -1) + 1
If (Not Intersect(Target, Range("B:B")) Is Nothing) Then
If (Not IsEmpty(Target)) Then
Target.Offset(0, -1) = ItemNum
Else
With Target.Offset(0, -1)
.ClearContents
End With
End If
End If
Exit Sub
ERRHANDLER:
MsgBox "SOMETHINGS NOT RIGHT..."
Exit Sub
End Sub