Run one macro for all macros instead of doing it one by one

krodriguez

Board Regular
Joined
Jul 11, 2012
Messages
119
Hello,

I have the following code with 2 macros and will like to run it all at once, how can I do this? Thanks

Sub SaveSheetsAsFiles()
Dim SheetsToSave
SheetsToSave = Array("Rainbow", "RLN-Net Realization", "RLN-Red Rev", "RLN-COGS", "RLN-Logistics", "RLN-R&D", "RLN-Selling", "RLN-Administrative", "RLN-Advertising", "RLN-Sales Promo") 'change tab names to suit
Application.ScreenUpdating = False
For Each sht In Sheets(SheetsToSave)
sht.Copy
'file location is same as workbook the code is in. Change to suit
'file format is .xlsm - change to suit
ActiveWorkbook.SaveAs Filename:=sht.Name & ".xlsm", FileFormat:=52
Next sht
Application.ScreenUpdating = True
End Sub


Sub SaveSheetsAsFiles2()
Dim SheetsToSave
SheetsToSave = Array("Neocell", "NC-Net Realization", "NC-Red Rev", "NC-COGS NC-Logistics", "NC-R&D", "NC-Selling", "NC-Administrative", "NC-Advertising", "NC-Sales Promo") 'change tab names to suit
Application.ScreenUpdating = False
For Each sht In Sheets(SheetsToSave)
sht.Copy
'file location is same as workbook the code is in. Change to suit
'file format is .xlsm - change to suit
ActiveWorkbook.SaveAs Filename:=sht.Name & ".xlsm", FileFormat:=52
Next sht
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top