G
Greg Snidow
Greetings all. I am not good at excel programming, but I figured out how to
add a command button and to record a new macro to assign to its click event.
I have a workbook with two worksheets, each having a separate SQL Server 2000
query as the datasource. During the record new macro step I highlighted the
first cell in the data range on the first worksheet, then hit Data>Refresh to
requery the data. Then I highlighted the first cell in the data range of
sheet 2 and did the same thing. The button works, but it shows all the steps
I included in the record step. Is there a way to refresh every sheet in the
workbook at once, with one click of the button, regardless of the source
query? The below is what was generated by the macro recorder.
Sub Button11_Click()
'
' Button11_Click Macro
' Macro recorded 10/8/2007 by greg snidow
'
' Keyboard Shortcut: Ctrl+d
'
Range("A8").Select
ActiveWindow.SmallScroll Down:=-9
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("EWO_VIEW").Select
Range("A4").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("VA VIEW").Select
End Sub
add a command button and to record a new macro to assign to its click event.
I have a workbook with two worksheets, each having a separate SQL Server 2000
query as the datasource. During the record new macro step I highlighted the
first cell in the data range on the first worksheet, then hit Data>Refresh to
requery the data. Then I highlighted the first cell in the data range of
sheet 2 and did the same thing. The button works, but it shows all the steps
I included in the record step. Is there a way to refresh every sheet in the
workbook at once, with one click of the button, regardless of the source
query? The below is what was generated by the macro recorder.
Sub Button11_Click()
'
' Button11_Click Macro
' Macro recorded 10/8/2007 by greg snidow
'
' Keyboard Shortcut: Ctrl+d
'
Range("A8").Select
ActiveWindow.SmallScroll Down:=-9
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("EWO_VIEW").Select
Range("A4").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("VA VIEW").Select
End Sub