Adding comments based on a filter in a pivot table

Javi A

New Member
Joined
Dec 19, 2018
Messages
3
Hi there!

I'd like toknow how is possible to make dynamic comments based on a filter in a pivottable by using a Macro or VB.

Thank you!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Re: Adding comments based on a filter in apivot table

Hi Javi,

Are you looking for something like this?

Code:
Sub UpdateComment()

    Dim Pvt As PivotTable
    Dim Arr()
    Dim Item As Long
    Dim CommentText As String
    
    Set Pvt = Sheet4.PivotTables("PivotTable1")
    Arr = Pvt.PageRangeCells
    CommentText = "Filter Values are:" & vbCrLf
    
    For Item = LBound(Arr) To UBound(Arr)
        CommentText = CommentText & Arr(Item, 1) & ": " & Arr(Item, 2) & vbCrLf
    Next Item
    
    Range("F10").Comment.Text CommentText

End Sub
 
Upvote 0
Re: Adding comments based on a filter in apivot table

First ofall, thank you for your macro.

I’d like tounderstand and translate this to my Excel File. I’ve got this:

The Program(cell A1, fo example) gives you the choice to select in cell “C2” diferent items. And on cell “H4”,based on what you select, you will have comments for each option of the filter.


Is thatwhat your macro execute?


Thank youvery much & have a good one!

 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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