Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I want the following code to refresh all my pivots (on protected sheets), then activate cell B2 on sheet "Source." The code does what I want when I run it in the VBA editor, but when I use the in-sheet button with the assigned macro, it never ends on the "Source" sheet. Am I missing a command after the final for loop. Any thoughts?
Private Sub FixSource() ' ' FixSource Macro ' Dim ws As Worksheet Dim pt As PivotTable Dim pc As PivotCache On Error Resume Next For Each ws In ActiveWorkbook.Worksheets ws.Unprotect Password:="password" pt.PivotCache.MissingItemsLimit = xlMissingItemsNone Next ws For Each pc In ActiveWorkbook.PivotCaches On Error Resume Next pc.Refresh Next pc For Each ws In ActiveWorkbook.Worksheets ws.Protect DrawingObjects:=True, _ Contents:=True, Scenarios:=True, _ Password:="password" Next ws Worksheets("Source").Select Range("B2").Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Slight Annoyance | Excel Programming | |||
a slight syntax error... | Excel Programming | |||
Need slight modification on macro below | Excel Programming | |||
Slight prob with this code | Excel Programming | |||
Slight Problem | Excel Discussion (Misc queries) |