Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Procedures in an Add-In DJB[_10_] Excel Programming 3 September 17th 05 08:11 AM
VBA Sub procedures lexiez Excel Programming 2 October 4th 04 04:21 PM
Scheduled Procedures R Avery Excel Programming 5 June 2nd 04 04:38 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM
Using Sub-procedures w/in a function LizUrish Excel Programming 2 November 6th 03 09:18 AM


All times are GMT +1. The time now is 04:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"