Hi,
I am new to VBA and am experiencing following problem.
I have created excel spreadsheet and need to record date record created, who created the record and who modifies the record as per below code
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Additional Charges").Select
If Target.Column = 1 And Target.Offset(0, 1).Value = "" Then
Target.Offset(0, 1) = Format(Now(), "dd/MM/yy")
'Set the user who created the record
Cells(Target.Row, 4).Value = UserName()
Else
End If
'Set the user who modified the record
Cells(Target.Row, 5).Value = UserName()
End Sub
This works well but when I need to delete a row/record using the right click menu on the row heading I get the error "Run-Time error 1004" - Application-defined or object-defined error.
I have driven myself almost insane trying to resolve but with no luck.
Any help greatly appreciated.
Thanks
I am new to VBA and am experiencing following problem.
I have created excel spreadsheet and need to record date record created, who created the record and who modifies the record as per below code
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Additional Charges").Select
If Target.Column = 1 And Target.Offset(0, 1).Value = "" Then
Target.Offset(0, 1) = Format(Now(), "dd/MM/yy")
'Set the user who created the record
Cells(Target.Row, 4).Value = UserName()
Else
End If
'Set the user who modified the record
Cells(Target.Row, 5).Value = UserName()
End Sub
This works well but when I need to delete a row/record using the right click menu on the row heading I get the error "Run-Time error 1004" - Application-defined or object-defined error.
I have driven myself almost insane trying to resolve but with no luck.
Any help greatly appreciated.
Thanks