Refresh VBA

A

Andy

I have a workbook with a macro below. Within a worksheet I have a number of
tables linked to an access query and would like a macro to refresh all of
these tables at once to pull the new data into my 'master' worksheet. Each
week however this worksheet is copied and renamed for audit purposes. However
when I run the macro below it updates the data in all of these archived
sheets as well.

So in my macro I either want to tell it to refresh the data in just the
'master' worksheet, or prevent it from updating data in the archived
worksheets.

Thanks


Sub Refresh_all_queries()
'
' Refresh_all_queries Macro
'

'
ActiveWorkbook.RefreshAll
Range("F27").Select
MsgBox "All data should have now been refreshed, please ensure that the
month to date figures are also completed.", vbInformation

End Sub
 
P

Patrick Molloy

I suspect that settign the pivot table backgroundQuery property to FALSE
might solve your problem

If not, you might want to chaneg how the data is fetched - so that in code
used ADODB rather than usign a worksheet query table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top