我想从Excel中的激活切片机中检索所选值,以便我可以在配方中使用它。我该怎么做?我一直在使用Microsoft VBA帮助网站与Slicer对象的ActiveItem一起玩,但我不熟悉VBA语法。
我想实现的是,所选单元格中的值等于名为“ slicer_organisatie___tariefgroep”的切片机中所选值,
我使用以下网站上的指南使用以下代码进行了尝试:
Sub TestSelectActiveSlicer()
'
' TestSelectActiveSlicer Macro
'
Range("H5").Select
ActiveCell = Slicer.ActiveItem
End Sub
当我运行宏时,我会收到以下错误:
运行时错误'424':
对象需要
任何帮助将不胜感激。
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://learn.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.
发布评论