Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
assign a macro
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
assign a macro
Thanks for the expeditious reply.
but i do not know anything about the vba so i have not understood where to paste the above said code. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
assign a macro
Right-click on your Worksheets's tab (down left)
Select View code This will open a new window, where you paste my code. If you're stuck, please post back! HTH -- AP "daidipya" a écrit dans le message de news: ... Thanks for the expeditious reply. but i do not know anything about the vba so i have not understood where to paste the above said code. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
assign a macro
this is amazing - i mean to say that for the first time i have come to
know about the google group and all this stuff. thanks once again for your reply i did the same but the result what i want i ma not getting. i have one macro as follows Sub HideRows() Dim Rng As Range Set Rng = Sheets("Sheet1").Range("B10") If Rng.Value = "YES" Then Rows("11:50").EntireRow.Hidden = False Range("B11").Select ElseIf Rng.Value = "NO" Then Rows("11:50").EntireRow.Hidden = True Range("B51").Select End If End Sub now this macro i want to assign to YEs or NO. when i pasted the code that you have given, i got a result of No or Yes instead of hiding or unhiding of the rows. ealrier i used to think that i know a lot about excel but now i am realising that i know nothing , even though i am a finance guy. i hope you would be able to sort my tiny problem |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to create a command button, then assign macro to it in excel | Excel Discussion (Misc queries) | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
assign macro | Excel Worksheet Functions | |||
Macro Help In Excel | Excel Discussion (Misc queries) | |||
Highlight Range - wrong macro, please edit. | Excel Worksheet Functions |