在 Excel 中显示数据之前,强制用户从切片器中选择一个选项

发布于 2025-01-17 21:59:31 字数 107 浏览 7 评论 0原文

我有一个从汇总数据中填充的表。因此,当从任何一个切片器中选择选项时,我的数据无效,因为它平均是平均值。是否可以通过VBA代码或某种高级选项进行方法,我可以在查看数据之前确保从两个切片机中选择一个选择?

I have a table which is is populated from summarized data. Because of this, when no options are selected from either slicer my data is invalid as it is averaging averages. Is there a way through VBA code or some sort of advanced options where I can make sure the user has selected a choice from both slicers before seeing the data?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你不是我要的菜∠ 2025-01-24 21:59:31

如果用户尚未选择任何内容,则过滤式属性应为真。
您可以在使用类似的内容时设置默认值。

With MyWorkbook.SlicerCaches("MySlicer")
    If .FilterCleared Then
        .TimelineState.SetFilterDateRange Format(Date - 7, "m/d/yyyy"), Format(Date, "m/d/yyyy")
    End If
End With

If the user hasn't selected anything, the FilterCleared property should be true.
You could set defaults when true using something like this.

With MyWorkbook.SlicerCaches("MySlicer")
    If .FilterCleared Then
        .TimelineState.SetFilterDateRange Format(Date - 7, "m/d/yyyy"), Format(Date, "m/d/yyyy")
    End If
End With
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文