I don't know where you found that code, but it raises an error for me. The
RefreshAll method is a method of the workbook, not the worksheet.
If it would work, you would use Worksheets("Sheet2").RefreshAll
to refer to a worksheet named Sheet2
If you have querytables on the sheet
Dim qt as QueryTable
for each qt in Worksheets("sheet2").QueryTables
qt.Refresh BackgroundQuery:=False
Next
for pivot Tables
Dim pt as PivotTable
for each pt in Worksheets("Sheet2").PivotTables
pt.RefreshTable
Next
Or if you just want to refresh the whole workbook
Workbooks("Myfile.xls").RefreshAll
--
Regards,
Tom Ogilvy
JasonSelf wrote in message
...
Well, this should be my last question for a little while. I need to
create a button that refreshes all data on a specific sheet (we will
call it sheet1) I found this Worksheets(2).RefreshAll that is supposed
to do just that. I just don't understand exactly how I specify my
worksheet. The 2 is not the name of any of my sheets but doing a
little searching I found that it may be the Index property....I do not
understand how I can determine the index property if that is indeed the
case.
Thanks for your help as always, any input would be greatly
appreciated.
Jason Self
---
Message posted from http://www.ExcelForum.com/