Need help to combine two VBA Macro code to run on a same worksheet

spycein

Board Regular
Joined
Mar 8, 2014
Messages
135
Office Version
  1. 365
Platform
  1. Windows
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 Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You can put both of those codes into Sub routines rather than on seperate on change events.
Sub macro1 and Sub macro2.
Then in the worksheet change event you can call the two macros
Call macro1
Call macro2
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,049
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top