Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 304
Default Refresh all but 1st sheet

Should't this work? Also, it ask to inmport text, how to say "yes" evertime?
Text name will be different ever time.

Sub Refreshall ()
For i = 2 To Sheets.Count
With Active.Sheet
Selection.QueryTable.Refresh BackgroundQuery:=False
Next i
End Sub

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Refresh all but 1st sheet

Hi,

Although the loop index goes from to to the number of sheets the refresh is
made on the activesheets selection, which never changes.
Disabling DisplayAlerts should suppress the dialogs.

Try something like this.

Sub Refreshall ()
application.displayalerts=false
For i = 2 To workSheets.Count
worksheets(i).QueryTable.Refresh BackgroundQuery:=False
Next i
application.displayalerts=true
End Sub

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"pgarcia" wrote in message
...
Should't this work? Also, it ask to inmport text, how to say "yes"
evertime?
Text name will be different ever time.

Sub Refreshall ()
For i = 2 To Sheets.Count
With Active.Sheet
Selection.QueryTable.Refresh BackgroundQuery:=False
Next i
End Sub

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 857
Default Refresh all but 1st sheet

Hi,

First, you should get an error with the With Active.Sheet command for 2
reasons
1. the command is ActiveSheet
2. every With should have and End With

You might modify you code to read:
Sub Refreshall ()
For i = 2 To Sheets.Count
Sheets(i).Range("A1").QueryTable.Refresh BackgroundQuery:=False
Next i
End Sub

As I read it the QueryTable.Refresh command requires a range that intersects
the querytable, so you could use selection if you can be sure the cursor is
in the querytable range. In the example above range A1 is assumed to be in
the querytable and below the range named Data is also.

I have not tested this code - you might need to make it read:

Sub Refreshall ()
For i = 2 To Sheets.Count
Sheets(i).Activate
Range("Data").QueryTable.Refresh BackgroundQuery:=False
Next i
End Sub

Cheers,
Shane Devenshire

"pgarcia" wrote in message
...
Should't this work? Also, it ask to inmport text, how to say "yes"
evertime?
Text name will be different ever time.

Sub Refreshall ()
For i = 2 To Sheets.Count
With Active.Sheet
Selection.QueryTable.Refresh BackgroundQuery:=False
Next i
End Sub

Thanks


Reply
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
Dynamically updating sheet upon data Refresh All? Alistair H Excel Discussion (Misc queries) 1 March 10th 08 08:36 PM
refresh sheet data Dragos Excel Discussion (Misc queries) 0 July 11th 07 09:12 AM
Refresh Pivot in Locked Sheet? Dark_Templar Excel Discussion (Misc queries) 1 June 5th 06 06:37 PM
Refresh data from an Excel sheet Sierras Excel Worksheet Functions 1 February 24th 06 08:44 PM
refresh external data on a protected sheet ajf Excel Discussion (Misc queries) 0 March 11th 05 09:01 AM


All times are GMT +1. The time now is 12:23 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"