I have two separate macros in my book: one that refreshes 12 tabs containing CSV data that points to a source outside the book (and which itself receives updated numbers each day); and one that updates data tables in other tabs in my book that rely on these 12 CSV-data tabs to be refreshed.
The idea is to refresh the CSV tabs with the outside numbers first, then update the data tables based on the newly-refreshed CSV data.
The problem I am running into is that when I try to combine the two macros, they basically run at the same time. What I typically see when I watch the book while the macro runs is that a couple of the tabs appear to refresh; then all the tables update based on the CSV data; then, when that's done, the rest of the CSV tabs appear to get refreshed.
Consequently, when this process completes, the book contains some tables that use new numbers because they happen to point to the CSV tabs that got refreshed first, and other tables using old numbers that got updated before the remaining CSV tabs got refreshed. I am trying to combine these macros so that it refreshes all 12 CSV tabs first, before it updates any data tables on other tabs. Am I making sense?
At first I tried going into VB and adding the Refresh_Tabs macro to the Update_Tables macro, with Refresh_tabs at the top, and that didn't work.
Then I found this thread:
Which looked like it would solve my problem, but even when I followed its instructions as shown here:
It still basically runs them at the same time, refreshing some CSV tabs, updating all the tables, and refreshing the remaining CSV tabs.
Any ideas how I can accomplish what I'm trying to here?
The idea is to refresh the CSV tabs with the outside numbers first, then update the data tables based on the newly-refreshed CSV data.
The problem I am running into is that when I try to combine the two macros, they basically run at the same time. What I typically see when I watch the book while the macro runs is that a couple of the tabs appear to refresh; then all the tables update based on the CSV data; then, when that's done, the rest of the CSV tabs appear to get refreshed.
Consequently, when this process completes, the book contains some tables that use new numbers because they happen to point to the CSV tabs that got refreshed first, and other tables using old numbers that got updated before the remaining CSV tabs got refreshed. I am trying to combine these macros so that it refreshes all 12 CSV tabs first, before it updates any data tables on other tabs. Am I making sense?
At first I tried going into VB and adding the Refresh_Tabs macro to the Update_Tables macro, with Refresh_tabs at the top, and that didn't work.
Then I found this thread:
How-To Run Multiple Macro's One After The Other
I have 4 macro's. The first macro format's data. The second macro saves the .xlsx with a unique name. The third macro merges data from other excel files. And the fourth macro saves the merged data as another .xlsx. Is there any way to run all the macro's at once and in order? If I group...
www.mrexcel.com
Which looked like it would solve my problem, but even when I followed its instructions as shown here:
Sub Update_Both()
'
' Update Macro
'
'
Call Refresh_Tabs
Call Update_Tables
End Sub
It still basically runs them at the same time, refreshing some CSV tabs, updating all the tables, and refreshing the remaining CSV tabs.
Any ideas how I can accomplish what I'm trying to here?