1

I have a complex Macro that I'd like to run on every file within a folder. The Looped Macro should end once every file has been modified.

I have modified some code found on this site, but it does not open any files within the folder. Do I need another "open" command for each file?

Sub LoopThroughFolder()

Dim StrFile As String
StrFile = Dir("C:\Users\Sample Folder\")
Do While Len(StrFile) > 0
    Application.Run "'FX Regression Model.xlsm'!CalculateWeighting"
    StrFile = Dir
Loop

End Sub

Any advice would be greatly appreciated. Thank you!

  • 1
    Does [this thread](http://stackoverflow.com/questions/14766238/run-same-excel-macro-on-multiple-excel-files) or does [this site](http://www.thespreadsheetguru.com/the-code-vault/2014/4/23/loop-through-all-excel-files-in-a-given-folder) help at all? Try searching SO, it's a question that gets asked somewhat often. – BruceWayne Oct 22 '15 at 01:00

0 Answers0