• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

help with this code please

Maxwolf

New Member
ok i have this code to retrieve select item list in a range of cell:



Code:
Sub Macro1()
Dim ar
ar = ThisWorkbook.SlicerCaches("Segment_Scolarité").VisibleSlicerItemsList

For i = 1 To UBound(ar)
    Range("E" & i) = ar(i)
   
Next

End Sub


it is working BUT the result look like this in the cell:

[Plage1].[Scolarité].&[1-Primaire]
[Plage1].[Scolarité].&[2-Secondaire]
[Plage1].[Scolarité].&[3-Apprenti]
[Plage1].[Scolarité].&[4-Collège]



I would like the result to look like this:

1-Primaire
2-Secondaire
3-Apprenti
4-Collège
 
Just use string manipulation.

ex.
Code:
Dim x
For i = 1 To UBound(ar)
    x = Split(ar(i), "[")
    x = Replace(x(UBound(x)), "]", "")
    Range("E" & i) = x
Next
 
Back
Top