Private Worksheet Pivot table Update is affecting Pivot table on another worksheet which uses same data source

trishcollins

Board Regular
Joined
Jan 7, 2006
Messages
71
I have a private function that calls two other public functions (modules) that automatically run when the Pivot Table is "refreshed".

This private function is associated to two different worksheets, each with a Pivot Table. One is the summary and one is the details. The source data is the same, which I think may be the issue here, as updating one table affects the others.

Here is the private function:

VBA Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Call Find_And_Bold_Tombstone
Call Find_And_Bold
End Sub

This function is a Private Worksheet function on two different worksheets, "Use Case Summary" and "Use Case Details". The Pivot tables are names "Use_Case_Summary" and "Use_Case_Details"

The "Find and Bold Tombstone" works fine, as it's not part of the Pivot Table, but affects a specific cell on the active worksheet. But the "Find and Bold" seems to affect both pivot tables in my workbook, which is fine, if it actually worked properly, but it doesn't. When refreshing the pivot table on the active worksheet, it works fine, but when I go to the other worksheet with the other Pivot table, the formatting is a mess, so I do a refresh there, and it works fine, but go back to the first one, and it is a mess. I will have to assume that this may just be the function of refreshing a pivot table which is using the same data source as the other. If that is the case, are there any suggestions as to how I get it to do both tables properly, if one is refreshed? The reason I separated them, is that they have a different number of items to look for, so a different number of items in each array. Here is the code:

VBA Code:
Sub Find_And_Bold()
'This finds and bolds heading text in Pivot Tables

Dim rcell As Range, sToFind As String, iSeek As Long
Dim Text()
Dim i As Integer
Dim Rng As Range
Dim pt As PivotTable
Dim SheetName As String
SheetName = ActiveSheet.Name

'MsgBox (ActiveSheet.Name)

'Determine Active Sheet and Assign Pivot Table Name

If ActiveSheet.Name = "Use Case Summary" Then
    Set pt = ActiveSheet.PivotTables("Use_Case_Summary")
    ReDim Text(1 To 18)
    Text(1) = "Client Input"
    Text(2) = "Resul
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,224,730
Messages
6,180,609
Members
452,991
Latest member
JM_000888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top