Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

Excel 2010 slicer - use selected item in graph headline

I have a "slicer" object in a Excel 2010 sheet, used to control 2 Graphs. How can I show the selected item name from the Slicer and show it in the graph headline text field ?

Please advice
Thanks
Mik
0
Bojerne
Asked:
Bojerne
  • 2
2 Solutions
 
BojerneAuthor Commented:
Found this I can use for part of the task :)
Private Sub Worksheet_PivotTableChangeSync(ByVal Target As PivotTable)
    Dim slItem As SlicerItem

   
    '---Optional: Exclude one or more PivotTables from triggering action
    If Target.Name = "PivotTable2" Then Exit Sub

   
    With ActiveWorkbook.SlicerCaches("Slicer_MyField")
        '---display selected items in the Immediate Window of the VB Editor
        Debug.Print "Visible Slicer Items: "

       
        For Each slItem In .VisibleSlicerItems
            Debug.Print slItem.Name
        Next slItem

       
        Debug.Print "~~~~~~~~~~~~~~~~~~"
    End With
End Sub
0
 
BojerneAuthor Commented:
Second part can be solved with this :)

Sub Macro1()
ActiveSheet.ChartObjects(1).Chart. _
ChartTitle.Characters.Text = "Text"
End Sub
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now