MrExcel Publishing
Your One Stop for Excel Tips & Solutions

how to get a macro to run at a specific time

Posted by Kevin on November 26, 2001 6:49 AM

I have a spreadsheet that automatically queries an access database upon opening, and inserts data from the database in the spreadsheet. some of the columns are too narrow to show the data after the query runs, so I tried inserting an auto_open macro to resize the columns after opening the sheet. The trouble is the macro runs first, then the query runs and the columns revert back to being too narrow. How do I get this macro to run AFTER the query is finished refreshing and not before?

Thanks in advance,

Posted by Bib on November 26, 2001 6:55 AM


To resize the columns after the query, simply do the query before the resize in the auto_open :
Record a macro that updates your query and paste it in auto_open. Then do the AutoFit. You may check the "don't update at opening" box in the query properties, so that it updates only when YOU say it in the auto_open, not "automatically"...

Hope it helps