Solved

Excel 2010 slicer - use selected item in graph headline

Posted on 2013-11-28
2
578 Views
Last Modified: 2013-11-28
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
Comment
Question by:Bojerne
  • 2
2 Comments
 
LVL 1

Assisted Solution

by:Bojerne
Bojerne earned 0 total points
ID: 39683325
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
 
LVL 1

Accepted Solution

by:
Bojerne earned 0 total points
ID: 39683342
Second part can be solved with this :)

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now