I am using the VBA below. I need it to do two things. One is if a user tries to "clear content" in column D, they should get a message box saying that they can't do that without first clearing their entry in column A. Second I noticed that if I select multiple entry's in column A and use the clear content, the info in column D does not clear. If I select just one entry it works fine, can this be fixed?
If anyone can help, thank you for your time.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Catch
'// Prevent any changes firing this event again
Application.EnableEvents = False
'// Change the '1' to ignore any heading rows
1 If Target.Row > 1 Then
'// Which column was changed?
Select Case Target.Column
'// A
Case 1
Target.Offset(, 3).Value = IIf(Len(Target.Value), "Changed By " & Environ("UserName") & " on " & Date & " @ " & Time, "")
Case 4
'// Prevent user changes to Col D
Application.Undo
Beep
End Select
End If
Catch:
'// Make sure event handling turned on again
Application.EnableEvents = True
End Sub
If anyone can help, thank you for your time.