1

ユーザーが整数を入力するまでメッセージボックスが消えないように、単純なループを修正しようとしています。これが私のコードです:

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
4

1 に答える 1

0

検討:

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

これにより、[キャンセル]をタップすると終了できます

于 2015-06-04T17:13:06.317 に答える