Hi everyone.. was trying to run two macros on a same sheet but getting the following error
"Excel vba ambiguous name detected worksheet_change"
Dont know how to combine the two codes..
Code 1:-
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 0
If Target.Count > 1 Then Exit Sub
If Target.Column <> 16 Then Exit Sub
If Target.Value = "Authorised" Then
Application.EnableEvents = False
Target.Offset(, -15).Resize(, 15).Copy Destination:=Sheets("Authorised").Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.EntireRow.Delete
Application.EnableEvents = True
End If
End Sub
Code 2:-
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column = 2 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 1).ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Please Help...
Thanks
"Excel vba ambiguous name detected worksheet_change"
Dont know how to combine the two codes..
Code 1:-
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 0
If Target.Count > 1 Then Exit Sub
If Target.Column <> 16 Then Exit Sub
If Target.Value = "Authorised" Then
Application.EnableEvents = False
Target.Offset(, -15).Resize(, 15).Copy Destination:=Sheets("Authorised").Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.EntireRow.Delete
Application.EnableEvents = True
End If
End Sub
Code 2:-
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column = 2 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 1).ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Please Help...
Thanks