Power query refresh

sadavies2906

New Member
Joined
Feb 5, 2011
Messages
45
Refreshing pivot query
I have the following macro that refreshes a power query and then refreshes the pivot table linked to the results


Sub REFRESH()
'
' REFRESH Macro
'

Application.ScreenUpdating = False
Sheets("RAW DATA").Select
Selection.ListObject.QueryTable.REFRESH BackgroundQuery:=False
Sheets("Work to List EP").Select
ActiveSheet.PivotTables("Work to List EP").PivotCache.REFRESH
Sheets("Overview").Select
Range("A1").Select
Application.ScreenUpdating = True
End Sub
I am trying to get a message box to appear while the query is running but am unable to get this to work.
I have seen the following code on Microsoft website and would like to include it in my refresh macro if that is possible and ideas what the code should look like?

With Worksheets(1).QueryTables(1)
If .Refreshing Then MsgBox "Query is currently refreshing: please wait"
Else
.Refresh BackgroundQuery := False
.ResultRange.Select
End If
End With

Any help appreciated

Stephen
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top