Making excel wait till query done
Hey all, got a quick question.
Im working on some vba stuff in excel and i have a query that runs and after, i build headers and footers based on the data returned. The problem im having is it doesnt seem that vba is waiting for the data to be returned before continuing. On some of the reports with only a few rows returned, the headers and footers are fine but on ones that take a while, the headers and footers are put in and when the data comes back it bumps the header and footer over to fit the data in.
Ive tried changing the .BackgroundQuery and .Refresh BackgroundQuery to false but those dont seem to fix it.. I could potentially just put a pause or something but i dont want the pause too long or too short so i would like to avoid that if possible.
Anyone have an idea?