'How to retrieve active value from slicer in Excel

I would like to retrieve the selected value from an activated slicer in Excel so I can use it in a formule. How would I do this? I've been playing around with the ActiveItem from the Slicer object using the Microsoft VBA help site but I'm not to familiar with the VBA syntax.

What I would like to achieve is that the value in the selected cell is equal to the selected value in the Slicer named ("Slicer_Organisatie___Tariefgroep")

I've tried it with the following code using the guidelines on the following site: https://docs.microsoft.com/en-us/office/vba/api/excel.slicer.activeitem

Sub TestSelectActiveSlicer()
'
' TestSelectActiveSlicer Macro
'
    Range("H5").Select
    ActiveCell = Slicer.ActiveItem


End Sub

When I run the macro I get the following error: Run-time error '424': Object required

Any help would be greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source