修复IsNumeric循环错误?

我正在尝试修复一个简单的循环,以便消息框不会消失,直到用户input一个整数。 这是我的代码:

Sub PlateMicro() strName = InputBox(Prompt:="Enter number of wells in plate. The default is 96 (8X12).", _ Title:="PLATE SETUP", Default:="96") Dim wellCount As Object Dim numericCheck As Boolean numericCheck = IsNumeric(wellCount) If IsNumeric(wellCount) Then Range("A1").Value = wellCount 'Enter the number of plate wells selected into template. Else: strName = InputBox(Prompt:="You must enter an integer. Enter number of wells in plate. The default is 96 (8X12)." _ , Title:="PLATE SETUP", Default:=userDefaultChoice) End If End Sub 

考虑:

 Sub intCHECK() Dim var As Variant var = "whatever" While Not IsNumeric(var) var = Application.InputBox(Prompt:="Enter integer", Type:=2) Wend MsgBox "Thanks!" End Sub 

如果您触摸取消,这将允许您退出