我有以下代码:
dim selectRange as Range
Set selectRange = Application.InputBox("Select your range", "Hello", , , , , , 8)
Run Code Online (Sandbox Code Playgroud)
当用户选择取消InputBox提示时,它将返回error of Object not set.
我试图使用Variant变量类型但我无法处理它.在取消的情况下,它返回False,同时在选择范围的情况下,它返回InputBox的范围.
我怎样才能避免这个错误?