Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Stringing Subs

I have a number of Subs:

Private Sub CommandButton1_Click()
Private Sub CommandButton2_Click()
Private Sub CommandButton3_Click()
etc.

They are pretty large.
Instead of coping the code into other Sub is
there a way to run all three at the same time?

???
Sub NewSub
Run Private Sub CommandButton1_Click()
Run Private Sub CommandButton2_Click()
Run Private Sub CommandButton3_Click()
End Sub
Does not work, any sugestions?

-Randy-





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Stringing Subs

Hi Randy,

Sub NewSub
CommandButton1_Click
CommandButton2_Click
CommandButton3_Click
End Sub

MP

"Randal W. Hozeski" a écrit dans le message de
...
I have a number of Subs:

Private Sub CommandButton1_Click()
Private Sub CommandButton2_Click()
Private Sub CommandButton3_Click()
etc.

They are pretty large.
Instead of coping the code into other Sub is
there a way to run all three at the same time?

???
Sub NewSub
Run Private Sub CommandButton1_Click()
Run Private Sub CommandButton2_Click()
Run Private Sub CommandButton3_Click()
End Sub
Does not work, any sugestions?

-Randy-







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Stringing Subs

In the sheet module, declare them as Public
Public Sub CommandButton1_Click()
MsgBox "#1"
End Sub

Public Sub CommandButton2_Click()
MsgBox "#2"
End Sub

Public Sub CommandButton3_Click()
MsgBox "#3"
End Sub

then in a general module

Sub RunAll()
Sheet1.CommandButton1_Click
Sheet1.CommandButton2_Click
Sheet1.CommandButton3_Click
End Sub

or

Sub RunAll()
Application.Run "Sheet1.CommandButton1_click"
Application.Run "Sheet1.CommandButton2_click"
Application.Run "Sheet1.CommandButton3_Click"
End Sub

Both worked for me.

--
Regards,
Tom Ogilvy



"Randal W. Hozeski" wrote in message
...
I have a number of Subs:

Private Sub CommandButton1_Click()
Private Sub CommandButton2_Click()
Private Sub CommandButton3_Click()
etc.

They are pretty large.
Instead of coping the code into other Sub is
there a way to run all three at the same time?

???
Sub NewSub
Run Private Sub CommandButton1_Click()
Run Private Sub CommandButton2_Click()
Run Private Sub CommandButton3_Click()
End Sub
Does not work, any sugestions?

-Randy-







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
How do i stop numbers stringing together ? AB Andy Bleese Excel Worksheet Functions 3 November 13th 06 05:00 PM
Stringing formulas again DavidB New Users to Excel 4 October 12th 06 07:02 AM
Stop text from stringing into next field when empty NothingButRomance Excel Worksheet Functions 7 May 17th 05 02:22 AM
Stop text from stringing into next field when empty NothingButRomance Excel Worksheet Functions 1 May 16th 05 11:09 AM
Stop text from stringing into next field when empty NothingButRomance Excel Worksheet Functions 2 May 15th 05 05:32 PM


All times are GMT +1. The time now is 03:26 AM.

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

About Us

"It's about Microsoft Excel"