Sub MyMacro() ConvertPivotReferences " S:\Data\Client", " S:\Client" End Sub Public Sub ConvertPivotReferences( _ ByVal OldPath As String, _ ByVal NewPath As String _ ) Dim Pivot As PivotCache Dim Connection As String Dim Position As Long Dim Count As Long For Each Pivot In ThisWorkbook.PivotCaches Connection = Pivot.Connection If InStr(Connection, OldPath) > 0 Then Connection = Replace(Connection, OldPath, NewPath) Count = Count + 1 End If Pivot.Connection = Connection Next MsgBox Count & " PivotTables changed." End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.