Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要实现的是,一旦宏运行,用户必须(手动,从工作表中而不是通过键入范围)选择一个范围,然后将其设置为 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