Excel VBA newbie here. I just need a macro that will refresh the queries I have on a single sheet I’m viewing. I already have the refresh macro but I always have to specify the sheet name that I want to refresh. Is it possible to have the macro run on whatever sheet I’m viewing? Here’s the macro in it’s current state:
Sub Refresh_Query()
Sheets("Sheet1").Select
Range("B6").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
End Sub
You want to use
ActiveSheet.Name, such as: