hello
I'm asking about update power query by vba .
I search for some code lines to put into workbook open event to update automatically instead of refresh manually from inside the sheet by right click and refresh .
any guys have idea ?
hello
I'm asking about update power query by vba .
I search for some code lines to put into workbook open event to update automatically instead of refresh manually from inside the sheet by right click and refresh .
any guys have idea ?
Hi Halk
If you have a power query table on (VBA) Sheet1 and cell B2 is within that result, this will work:
Private Sub Workbook_Open()
Sheet1.Range("B2").ListObject.QueryTable.Refresh BackgroundQuery:=False
MsgBox "Power query updated on opening"
End Sub
You don't need the message box and need to change the bits in bold to suit you. Also you could replace Sheet1 with Worksheets("yourSheetName") if you like.
Hope this works for you.