Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL2000: Refresh Data for Active Sheet Only

Status
Not open for further replies.

locutis

Programmer
Nov 3, 2006
53
0
0
US
Hello,

I now I can do a macro to refresh the workbook:
ActiveWorkbook.RefreshAll

But it is very slow. Is there a way to refresh only the active sheet? Or can someone offer another solution to speed this up? I tried several things and researched but was unable to find a solution. Thought maybe one of the experts here might be able to help.

Thanks,
Jean Luc
 


Hi,
Code:
dim pt as pivottable, qt as querytable, sSheet as string
ssheet = "yoursheetname"
for each pt in Worksheets(ssheet).Pivottables
   pt.pivotcache.refresh
next
for each qt in Worksheets(ssheet).querytables
   qt.refresh
next


Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Wow, thanks Skip! I'll implement your code and let you know how it goes.

Jean Luc
 



if you do it on the activesheet, then...
Code:
ssheet = activesheet.name
or you could substitute ActiveSheet for Worksheets(ssheet)

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top