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.