Tag: error handlinginput

处理InputBox的取消select范围

我有以下一段代码: dim selectRange as Range Set selectRange = Application.InputBox("Select your range", "Hello", , , , , , 8) 当用户select取消input框提示时,它将返回error of Object not set 。 我试图使用Variantvariablestypes,但我无法处理它。 如果取消,则返回False ,同时在select范围的情况下返回InputBox的Range。 我怎样才能避免这个错误?