如何从excel中的切片机中检索主动值

发布于 2025-01-29 07:51:13 字数 608 浏览 3 评论 0 原文

我想从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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文