ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running macro on Open (https://www.excelbanter.com/excel-programming/417797-running-macro-open.html)

ETLahrs

Running macro on Open
 
I have a workbook in which 2 of the worksheets are filled with external data
from 2 separate text files. The workbook will be utilized daily and the text
files will also be updated daily. To keep the data current, I have the
refresh on the data as everytime the workbook is opened. I also have 3
macros that extract/analyze the data from the text files.

I had set the 3 macros to run on the open of the workbook, however they run
before the data is updated from the text files. Is there a way to refresh
the data first, then have th macros run?

Thanks for the help.
Ed

Bernie Deitrick

Running macro on Open
 
Ed,

You can schedule those three macros to run after opening by using the Application.OnTime method in
the autoopen macro/ open event.

HTH,
Bernie
MS Excel MVP


"ETLahrs" wrote in message
...
I have a workbook in which 2 of the worksheets are filled with external data
from 2 separate text files. The workbook will be utilized daily and the text
files will also be updated daily. To keep the data current, I have the
refresh on the data as everytime the workbook is opened. I also have 3
macros that extract/analyze the data from the text files.

I had set the 3 macros to run on the open of the workbook, however they run
before the data is updated from the text files. Is there a way to refresh
the data first, then have th macros run?

Thanks for the help.
Ed




ETLahrs

Running macro on Open
 
Thanks. That will work. The only other idea I came up with was doing
Selection.QueryTable.Refresh BackgroundQuery:=False
before the macros.

Thanks Again.

"Bernie Deitrick" wrote:

Ed,

You can schedule those three macros to run after opening by using the Application.OnTime method in
the autoopen macro/ open event.

HTH,
Bernie
MS Excel MVP


"ETLahrs" wrote in message
...
I have a workbook in which 2 of the worksheets are filled with external data
from 2 separate text files. The workbook will be utilized daily and the text
files will also be updated daily. To keep the data current, I have the
refresh on the data as everytime the workbook is opened. I also have 3
macros that extract/analyze the data from the text files.

I had set the 3 macros to run on the open of the workbook, however they run
before the data is updated from the text files. Is there a way to refresh
the data first, then have th macros run?

Thanks for the help.
Ed






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

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