ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call another Macro (https://www.excelbanter.com/excel-programming/320436-call-another-macro.html)

Sandy

Call another Macro
 
How do I call a workbook module in a worksheet module

Private Sub Commandbutton1_Click()
My Code
Then when complete call

Sub Update()

Thanks!




Tom Ogilvy

Call another Macro
 
Private Sub Commandbutton1_Click()
' My Code
Update
End sub


or (less used)

Private Sub Commandbutton1_Click()
' My Code
Call Update()
End sub

--
Regards,
Tom Ogilvy

"Sandy" wrote in message
...
How do I call a workbook module in a worksheet module

Private Sub Commandbutton1_Click()
My Code
Then when complete call

Sub Update()

Thanks!






Bernie Deitrick

Call another Macro
 
Sandy,

In the worksheet's codemodule:

Private Sub Commandbutton1_Click()
'Your code here
Update
End Sub

In a regular module:
Sub Update()
'Your other code here
End Sub

HTH,
Bernie
MS Excel MVP

"Sandy" wrote in message
...
How do I call a workbook module in a worksheet module

Private Sub Commandbutton1_Click()
My Code
Then when complete call

Sub Update()

Thanks!






David

Call another Macro
 
Tom Ogilvy wrote

Private Sub Commandbutton1_Click()
' My Code
Call Update()
End sub


Using XL2000 at least, I've found that Call Update works without the '()',
but I normally just use Update

--
David

Tom Ogilvy

Call another Macro
 
Since there are no arguments for the Update Sub, that is true. I was trying
to emphasize that if you use the CALL syntax, that the arguments must be
enclosed in parentheses. Conversely, if you don't use call, they should not
be enclosed in parentheses unless it is a function returning a value that is
used by the calling program.

--
Regards,
Tom Oglvy

"David" wrote in message
...
Tom Ogilvy wrote

Private Sub Commandbutton1_Click()
' My Code
Call Update()
End sub


Using XL2000 at least, I've found that Call Update works without the '()',
but I normally just use Update

--
David





All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com