ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Initiate Macro via change in drop Down List (https://www.excelbanter.com/excel-programming/401232-initiate-macro-via-change-drop-down-list.html)

Sean

Initiate Macro via change in drop Down List
 
How can I initiate a Macro when I change a selection from a DV
Dropdown list?

I have a DV Drop down that selects a week, I then have to run a macro
that clears data. Could I in effect join the two together, if so how?


Thanks

Gary''s Student

Initiate Macro via change in drop Down List
 
We can use an event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1")
If Intersect(Target, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B1").Clear
Application.EnableEvents = True
End Sub

If you change A1 (whether by DV or typing) B1 is cleared.

This goes in the worksheet code area, not a standard module
--
Gary''s Student - gsnu2007a


"Sean" wrote:

How can I initiate a Macro when I change a selection from a DV
Dropdown list?

I have a DV Drop down that selects a week, I then have to run a macro
that clears data. Could I in effect join the two together, if so how?


Thanks


Sean

Initiate Macro via change in drop Down List
 
Thanks Gary, is it possible to call a macro from within, in the
Workseet code (thats already within a standard module)?


Sean

Initiate Macro via change in drop Down List
 
Just did it, simple just quote the macro. Always confused if you can
or cannot call a macro from outside a standard module



All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com