View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jerredjohnson[_2_] jerredjohnson[_2_] is offline
external usenet poster
 
Posts: 1
Default run-time error '9': Subscript out of range


Can anyone tell me why i get this error?

Sub ChangePivotCache()
'change pivot cache for all pivot tables in workbook
Dim pt As PivotTable
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
For Each pt In wks.PivotTables
pt.CacheIndex = Sheets("Pivot").PivotTables(1).CacheIndex
Next pt
Next wks

End Sub

PLEASE HELP!!


--
jerredjohnson
------------------------------------------------------------------------
jerredjohnson's Profile: http://www.excelforum.com/member.php...o&userid=32236
View this thread: http://www.excelforum.com/showthread...hreadid=520228