A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Call the Refresh method of your query in Workbook_Open before you call your macro, i.E.:
Sheets("Sheet1").QueryTables(1).Refresh
Andreas.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
My Excel file needs to have the two things happen automatically whenever someone opens it:
** In that order.
I know how to create the query so it automatically runs upon startup, and I know how to put run a macro using Workbook_Open(). But doing these causes the macro to run first, and the data query second. I need to reverse that order as indicated above.
Can anyone tell me how to do that?
Note I'm a total beginner in VB but pretty advanced in most of Excel.
Thanks so much y'all.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Call the Refresh method of your query in Workbook_Open before you call your macro, i.E.:
Sheets("Sheet1").QueryTables(1).Refresh
Andreas.
Answer accepted by question author
Hi
Andreas is correct.
It would be best not to update automatically on startup, infact disable it from doing so. The control the refresh/update in your Workbook_Open macro.
This thread may contain some useful code for how to do the update and have the the macro run after the data refresh has completed.
http://social.technet.microsoft.com/Forums/en-US/excel/thread/ebf70407-6411-485b-a464-5aee1236c61e
Hope this helps