Forum Discussion
icorte
May 23, 2019Copper Contributor
can you add a Macro Button based on Slicers?
I have a document with 4 connected slicers. Basically a road/process map on what text to log in salesforce. I want to assign a macro where someone can click a "button" and text will populate in ...
Berndvbatanker
May 24, 2019Iron Contributor
Hi,
i create an example which use slicers to control listobjects. All selected slicers will be written in cell K1
Sub SelectSelectedSlicer()
Dim sC As SlicerCache
Dim objItem As Object
Dim strSelection As String
Set sC = ActiveWorkbook.SlicerCaches(1)
With sC
For Each objItem In .SlicerItems
If objItem.Selected = True Then
strSelection = strSelection & objItem.Caption & vbLf
End If
Next objItem
Sheet1.Range("K1").Value = strSelection
End With
End Sub
best regards
Bernd
http://www.vba-Tanker.com