carobiscuit
09-28-2012, 10:44 AM
Hello,
I have set up formatting and opening/closing macros for files to append to a master database file. I am new to VBA and can't see a way to keep this from going back to the FIRST macro that opens all .csv files rather than the 3 following the "for each" statement.
Sub ReportMacro()
Dim ws As Worksheet
Application.Run "PERSONAL.XLSB!importfile" // i want this to run one time only
For Each ws In ActiveWorkbook.Worksheets
Application.Run "PERSONAL.XLSB!Report"
Application.Run "PERSONAL.XLSB!AppendData"
Application.Run "PERSONAL.XLSB!closeworksheet"
Next ws //I want this to loop back to "Report" macro
End Sub
Thanks so much for any help
I have set up formatting and opening/closing macros for files to append to a master database file. I am new to VBA and can't see a way to keep this from going back to the FIRST macro that opens all .csv files rather than the 3 following the "for each" statement.
Sub ReportMacro()
Dim ws As Worksheet
Application.Run "PERSONAL.XLSB!importfile" // i want this to run one time only
For Each ws In ActiveWorkbook.Worksheets
Application.Run "PERSONAL.XLSB!Report"
Application.Run "PERSONAL.XLSB!AppendData"
Application.Run "PERSONAL.XLSB!closeworksheet"
Next ws //I want this to loop back to "Report" macro
End Sub
Thanks so much for any help