ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Attaching drop down to macro (https://www.excelbanter.com/excel-programming/299652-attaching-drop-down-macro.html)

pvdalen

Attaching drop down to macro
 
Hi all,

Forgive me if this turns out to be too easy, but I've a
nice, little macro that runs based on the value in a cell
from a drop down box. Right now, one has to select the
value, then run the macro. I'm sure there's a way to run
the macro from the drop down selection, but I just can't
figure it out.

Any help would be greatly appreciated.

Thanks a bunch,
Paul

Bob Phillips[_6_]

Attaching drop down to macro
 
Depends upon what sort of drop-down.

If it is a Forms control, just right-click and assign your macro.

If it is a control toolbox control, create a control Click event and run
your macro in there.

If it is a Data Validation, and you have XL2000 or above, you can use
worksheet change event on the cell and run your macro in there.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pvdalen" wrote in message
...
Hi all,

Forgive me if this turns out to be too easy, but I've a
nice, little macro that runs based on the value in a cell
from a drop down box. Right now, one has to select the
value, then run the macro. I'm sure there's a way to run
the macro from the drop down selection, but I just can't
figure it out.

Any help would be greatly appreciated.

Thanks a bunch,
Paul




Roger Whitehead[_4_]

Attaching drop down to macro
 
In the Worksheet Module:
(Data Validation List) cell is E5


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$5" Then
Application.Run Target.Value
End If
End Sub


--
HTH
Roger
Shaftesbury (UK)



"pvdalen" wrote in message
...
Hi all,

Forgive me if this turns out to be too easy, but I've a
nice, little macro that runs based on the value in a cell
from a drop down box. Right now, one has to select the
value, then run the macro. I'm sure there's a way to run
the macro from the drop down selection, but I just can't
figure it out.

Any help would be greatly appreciated.

Thanks a bunch,
Paul





All times are GMT +1. The time now is 03:34 AM.

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