Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lunker55
 
Posts: n/a
Default 1 button for 2 macros

I have two macros. I would like to press 1 macro button that will do both
macros.
Is there a way to do this?
Macros are below,
Joe

Sub SaveAsCellString()
ActiveWorkbook.SaveAs Filename:= _
"C:\shipway\invoices\" & Range("E5").Formula,
FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub



Sub clearform()
'
' clearform Macro
' Macro recorded 20/06/2005 by Joe Clarkson
'

'
Range("A16:C28").Select
Selection.ClearContents
Range("E8").Select
Selection.ClearContents
End Sub



  #2   Report Post  
Pank
 
Posts: n/a
Default

Lunker55,

Amalgamate you macros.

Assume that the first macro is called Save and the second macro is called
clearform. Assume that you want to run CLEARFORM after SAVE do the following:-

Just before the END SUB in SAVE type CLEARFORM

HTH

Pank

"lunker55" wrote:

I have two macros. I would like to press 1 macro button that will do both
macros.
Is there a way to do this?
Macros are below,
Joe

Sub SaveAsCellString()
ActiveWorkbook.SaveAs Filename:= _
"C:\shipway\invoices\" & Range("E5").Formula,
FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub



Sub clearform()
'
' clearform Macro
' Macro recorded 20/06/2005 by Joe Clarkson
'

'
Range("A16:C28").Select
Selection.ClearContents
Range("E8").Select
Selection.ClearContents
End Sub




  #3   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi Joe,

Try assigning the following macro to your button:

SubRunBoth()
Call clearform
Call SaveAsCellString
End Sub

This assumes that you want to the clearform macro to be run first. If this
assumption is wrong, reverse the sequence of the two Call statements.

---
Regards,
Norman



"lunker55" wrote in message
...
I have two macros. I would like to press 1 macro button that will do both
macros.
Is there a way to do this?
Macros are below,
Joe

Sub SaveAsCellString()
ActiveWorkbook.SaveAs Filename:= _
"C:\shipway\invoices\" & Range("E5").Formula,
FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub



Sub clearform()
'
' clearform Macro
' Macro recorded 20/06/2005 by Joe Clarkson
'

'
Range("A16:C28").Select
Selection.ClearContents
Range("E8").Select
Selection.ClearContents
End Sub





  #4   Report Post  
Phil Wales
 
Posts: n/a
Default

Easy way to do it is record a 3rd macro while clicking macro 1 & macro 2 and
call it maro 3



"lunker55" wrote:

I have two macros. I would like to press 1 macro button that will do both
macros.
Is there a way to do this?
Macros are below,
Joe

Sub SaveAsCellString()
ActiveWorkbook.SaveAs Filename:= _
"C:\shipway\invoices\" & Range("E5").Formula,
FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub



Sub clearform()
'
' clearform Macro
' Macro recorded 20/06/2005 by Joe Clarkson
'

'
Range("A16:C28").Select
Selection.ClearContents
Range("E8").Select
Selection.ClearContents
End Sub




  #5   Report Post  
lunker55
 
Posts: n/a
Default

Thank you both!

Joe

"lunker55" wrote in message
...
I have two macros. I would like to press 1 macro button that will do both
macros.
Is there a way to do this?
Macros are below,
Joe

Sub SaveAsCellString()
ActiveWorkbook.SaveAs Filename:= _
"C:\shipway\invoices\" & Range("E5").Formula,
FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub



Sub clearform()
'
' clearform Macro
' Macro recorded 20/06/2005 by Joe Clarkson
'

'
Range("A16:C28").Select
Selection.ClearContents
Range("E8").Select
Selection.ClearContents
End Sub







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
Command Button anomalies RWN Excel Discussion (Misc queries) 5 May 4th 05 05:09 AM
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 10:57 PM
sorting with macros Sorting in macros Excel Discussion (Misc queries) 1 February 1st 05 09:02 AM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 12:21 AM


All times are GMT +1. The time now is 08:58 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"