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:
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:
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