HELP: Running two Macros, one before the other

  • Thread starter Thread starter Bobbak
  • Start date Start date
B

Bobbak

I have this Excel spreadsheet in which I want to automate, I have two
macros once called Macro_GetData, and Macro_FormatData. Both these
Macros work fine, but when I try to automate them it runs the 2nd
Macro before the 1st Macro is even finish. I tried to use the
"Application.Wait" command but that just stopped the macros. What I
want the macro to do is to run the first Macro (Macro_GetData) and
when that's finished then run the second Macro (Macro_FormatData). How
can I go about doing this?
 
Public Sub AutomatedProc()
Call Macro_GetData
Call Macro_FormatData
End Sub

run the proc AutomatedProc which will run the two procs
one after the other

Patrick Molloy
Microsoft Excel MVP
 
Patrick, what you suggested didn't work. I need the second macro to
run once the first macro is completed. In other words when the first
marco runs, once it's gets the data from the Import External Data (Web
Query), and fills out the worksheet then and only then have the macro
run the second macro. Here is the initial code that I have:


Sub Auto_Open()
Application.Run "'AgentStats (Auto).xls'!Macro_GetData" 'Calls the
Web Query
Application.Run "'AgentStats (Auto).xls'!Macro_FormatData" 'Formats
the Data
End Sub


Now the Macros Macro_GetData, and Macro_FormatData work perfectly when
I run them manually. What I need to figure out it to how to make work
that when the data from the Macro_GetData is loaded on the worksheet
to then run the Macro_FormatData.
 
If anyone knows an aswer to figuring out my problem I'd very much apperciate it.
-Bobbak
 
Back
Top