ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP: Running two Macros, one before the other (https://www.excelbanter.com/excel-programming/284309-help-running-two-macros-one-before-other.html)

Bobbak

HELP: Running two Macros, one before the other
 
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?

patrick molloy

HELP: Running two Macros, one before the other
 
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



-----Original Message-----
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?
.


Bobbak

HELP: Running two Macros, one before the other
 
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.


"Patrick Molloy" wrote in message ...
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



-----Original Message-----
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?
.


Bobbak

HELP: Running two Macros, one before the other
 
If anyone knows an aswer to figuring out my problem I'd very much apperciate it.
-Bobbak


(Bobbak) wrote in message . com...
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.


"Patrick Molloy" wrote in message ...
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



-----Original Message-----
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?
.



All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com