Thread: assign a macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default assign a macro

In Worksheet's code, paste the following (adapt to your needs):

HTH
--
AP

'---------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rWatch As Range
Set rWatch = Range("B10")
If Intersect(Target, rWatch) Is Nothing Then Exit Sub
Call myMacro(rWatch.Value)
End Sub

Sub myMacro(sVal As String)
MsgBox sVal
End Sub
'-------------------------------------

"daidipya" a écrit dans le message de news:
...
Hi

In my worksheet at cell B10 the drop down has a selection of either
YES or NO. After i select YES or NO then to run the macro assigned to
this i have select the Tolls then Macro then Macro and then run the
macro. instead i want the macro to run automatically on selection of
either YES or NO.

please guide me.

regards

daidipya