LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Command button to refresh data

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 DataRefresh 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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create refresh button in worksheet to refresh Pivot Table Data Ron Excel Worksheet Functions 1 October 13th 07 01:20 AM
Adding button to worksheet to refresh pivot table data Ron Excel Worksheet Functions 1 October 11th 07 12:13 PM
Refresh Multiple Queries via a Command Button Dmorri254 Excel Programming 2 February 27th 06 03:45 PM
refresh data command message Vince Stitt Excel Programming 0 June 2nd 05 10:31 PM
how to create button commande to refresh data in query in excel 2. Jean-Francois Excel Discussion (Misc queries) 1 January 6th 05 08:03 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"