gpt4 book ai didi

excel - VBA 如何强制用户使用 Excel 的内置范围选择来选择范围?

转载 作者:行者123 更新时间:2023-12-04 22:08:57 25 4
gpt4 key购买 nike

我想要实现的是,一旦宏运行,用户必须(手动,从工作表中而不是通过键入范围)选择一个范围,然后将其设置为 Range 变量。

Excel 确实在许多领域都有这样的功能,例如图表的数据选择设置,但我不知道如何访问它。任何和所有的帮助表示赞赏!

最佳答案

下面将强制用户选择一个范围:

On Error Resume Next

Dim rng As Range

Do
Set rng = Application.InputBox(Prompt:="Select Range", Type:=8)
Loop While rng Is Nothing

If Not rng Is Nothing Then rng.Select

On Error GoTo 0

关于excel - VBA 如何强制用户使用 Excel 的内置范围选择来选择范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13857298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com