Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sub procedures in commandbutton script help
Thanks Tom-
I think one of my petty errors was also not realizing I had already established AL1 as a range variable as well as sub. Hopefully this'll do the trick. Thanks again! "Tom Ogilvy" wrote: You call a procedure by entering it name. Assume you have three procedures located in a general module (insert=Module in the VBE) Sub Macro1() msgbox "In Macro1" End Sub Sub Macro2() msgbox "In Macro2" End Sub Sub Macro3() msgbox "In Macro3" End Sub then in your event code Private Sub CommandButton1_Click() Dim v as Long v = int(rnd()*3+1) if v = 1 then macro1 elseif v = 2 then macro2 elseif v = 3 then macro3 end if End Sub -- Regards, Tom Ogilvy "VB Newbie" wrote in message ... I have sub procedures A1, A2, and A3 and I am looking to run them based on criteria of a script for commandbutton1()_click. i.e. Dim x as range, y as range, z as range If x.value 0 then open sub procedure A1 else if y.value 0 then open sub procedure A2 else open sub procedure A3 end if end if I'm not sure how to open these subs up and how/where to declare them. Any assistance would be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Event Procedures in an Add-In | Excel Programming | |||
VBA Sub procedures | Excel Programming | |||
Scheduled Procedures | Excel Programming | |||
Excel 2000/XP script to Excel97 script | Excel Programming | |||
Using Sub-procedures w/in a function | Excel Programming |