VBA worksheet change event to launch macro??

joeshu26

Board Regular
Joined
Oct 30, 2013
Messages
136
Hi,

I am need my macro SORT_SAP1 to launch if cell "P12" changes. Can some one help me with the correct syntax for the worksheet change event?

Thank you!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Note: The Worksheet_Change event triggers from a user change (not from a calculation).

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] Worksheet_Change([COLOR=darkblue]ByVal[/COLOR] Target [COLOR=darkblue]As[/COLOR] Range)
    [COLOR=darkblue]If[/COLOR] Target.Address(0, 0) = "P12" [COLOR=darkblue]Then[/COLOR] SORT_SAP1
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
 
Upvote 0
It doesn't seem to work, but maybe it because Worksheet_Change is not the appropriate method?

I have a Combo Box (Form Control), and based on the value I select a number populates in cell "P12", so that when the number changes I need my macro to run...
 
Upvote 0
It doesn't seem to work, but maybe it because Worksheet_Change is not the appropriate method?

I have a Combo Box (Form Control), and based on the value I select a number populates in cell "P12", so that when the number changes I need my macro to run...


Right-click on the Form control combobox and assign your macro to it. You wouldn't need the worksheet_change event procedure.
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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