In attempting to place two change events in the same worksheet, I get an error message saying "Ambiguous Name". As a VBA newbie, I've been unable to correctly interpret the Help section (despite many trials and errors). Here's what's supposed to happen:
1) When a customer orders a product, staff enters the $ amount in column K. This activates a date-stamp in column A.
2) When the customer's payment is received, staff enters the $ amount in column L, which activates a date-stamp in column X.
Each of the codes below works fine when it is the only change event. But when I add the second event, the "Ambiguous Name" message appears. I've attempted numerous edits without success. Any help is much appreciated. Thank you.
Mark
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("K:K")
If Intersect(Target, rng) Is Nothing Then Exit Sub
ActiveSheet.Unprotect ("e")
Target.Offset(0, -10) = Date
ActiveSheet.Protect ("e")
End Sub
------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("L:L")
If Intersect(Target, rng) Is Nothing Then Exit Sub
ActiveSheet.Unprotect ("e")
Target.Offset(0, 12) = Date
ActiveSheet.Protect ("e")
End Sub
1) When a customer orders a product, staff enters the $ amount in column K. This activates a date-stamp in column A.
2) When the customer's payment is received, staff enters the $ amount in column L, which activates a date-stamp in column X.
Each of the codes below works fine when it is the only change event. But when I add the second event, the "Ambiguous Name" message appears. I've attempted numerous edits without success. Any help is much appreciated. Thank you.
Mark
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("K:K")
If Intersect(Target, rng) Is Nothing Then Exit Sub
ActiveSheet.Unprotect ("e")
Target.Offset(0, -10) = Date
ActiveSheet.Protect ("e")
End Sub
------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("L:L")
If Intersect(Target, rng) Is Nothing Then Exit Sub
ActiveSheet.Unprotect ("e")
Target.Offset(0, 12) = Date
ActiveSheet.Protect ("e")
End Sub