Run a Macro for multple spreadsheets at once

AEL8871

New Member
Joined
Nov 19, 2015
Messages
23
I'm wondering if there is an easy Visual Basic program that can do this:

I have multiple spreadsheets (any where from 1 to 300 on any given day). For each of these spreadsheets I need to run the same Macro and then save the result in a specific folder. Is there a way to do this in a batch where I can do this for all spreadsheets at once?

1. Spreadsheet1.xls
2. Run Macro1
3. Save Spreadsheet1.xls in X filepath

1. Spreadsheet2.xls
2. Run Macro1
3. Save Spreadsheet2.xls in X Filepath

So on and so forth.

I'm not sure if this will play a part but Macro1 links to several other macros. The last line of Macro1 states "Application.Run "xxx".
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
It's possible but you need to provide more information. Where is your batch of multiple workbooks (Excel files) located? How will you know which ones you need to process?

It is also important to know how Macro1 is written to ensure it's compatible with ActiveWorkbook. Please post all of the code for Macro1 here, and use code tags:

[code]
paste your code here
[/code]
 
Upvote 0
Code:
Sub PLYGC()
'
' PLYGC Macro
'
 Cells.Select
    Selection.RowHeight = 15
    ActiveWindow.Zoom = 85
    Range("C:C,G:G,J:K,M:N,Q:R,T:T,X:Y").Select
    Range("X1").Activate
    Selection.Delete Shift:=xlToLeft
    Range("T:X,Z:AC").Select
    Range("Z1").Activate
    ActiveWindow.SmallScroll ToRight:=10
    Range("T:X,Z:AC,AD:AI,AK:AK").Select
    Range("AK1").Activate
    ActiveWindow.SmallScroll ToRight:=15
    Range("T:X,Z:AC,AD:AI,AK:AK,AN:AN,AP:AP,AQ:BB").Select
    Range("AQ1").Activate
    ActiveWindow.SmallScroll ToRight:=10
    Range("T:X,Z:AC,AD:AI,AK:AK,AN:AN,AP:AP,AQ:BB,BC:BC,BE:BE,BG:BW").Select
    Range("BG1").Activate
    Selection.Delete Shift:=xlToLeft
    ActiveWindow.LargeScroll ToRight:=-2
    Columns("J:J").Select
    Selection.Delete Shift:=xlToLeft
    Columns("S:S").Select
    Selection.Cut
    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight
    Columns("B:B").Select
    Selection.Insert Shift:=xlToRight
    Selection.ColumnWidth = 28
    Rows("1:2").Select
    Range("A2").Activate
    Selection.Delete Shift:=xlUp
      Application.Run "PERSONAL.XLSB!InsertPics2"
'
End Sub
 
Upvote 0
In response to where the workbooks will be it will be all in the same folder on my desktop. I'll put the raw files in the folder and then run the batch from that folder and then save them in a separate folder.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,938
Members
448,534
Latest member
benefuexx

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