rahulsahu910
New Member
- Joined
- Apr 8, 2019
- Messages
- 7
Hi,
I am trying to select multiple items in a given slicer, i recorded a macro to check how it happens and the result is below
Sub Macro1()
'
' Macro1 Macro
'
ActiveWorkbook.SlicerCaches("Slicer_costcentername1").VisibleSlicerItemsList = _
Array( _
"[costcentername].&[abc]", _
"[costcentername].&[def]", _
"[costcentername].&[ghi]", _
"[costcentername].&[jkl]")
End Sub
Tried to replicate the same thing as below
Sub Macro1()
'
' Macro1 Macro
'
Dim st As String
st = """_[costcentername].&[abc]""" + ",_" + """[costcentername].&[def]""" + ",_" + """[costcentername].&[ghi]" + ",_" + "[costcentername].&[jkl]"""
ActiveWorkbook.SlicerCaches("Slicer_costcentername1").VisibleSlicerItemsList = Array(st)
End Sub
But the above code selects all the options present in the slicer. Kindly help to resolve the issue.
I am trying to select multiple items in a given slicer, i recorded a macro to check how it happens and the result is below
Sub Macro1()
'
' Macro1 Macro
'
ActiveWorkbook.SlicerCaches("Slicer_costcentername1").VisibleSlicerItemsList = _
Array( _
"[costcentername].&[abc]", _
"[costcentername].&[def]", _
"[costcentername].&[ghi]", _
"[costcentername].&[jkl]")
End Sub
Tried to replicate the same thing as below
Sub Macro1()
'
' Macro1 Macro
'
Dim st As String
st = """_[costcentername].&[abc]""" + ",_" + """[costcentername].&[def]""" + ",_" + """[costcentername].&[ghi]" + ",_" + "[costcentername].&[jkl]"""
ActiveWorkbook.SlicerCaches("Slicer_costcentername1").VisibleSlicerItemsList = Array(st)
End Sub
But the above code selects all the options present in the slicer. Kindly help to resolve the issue.