我被困在VBA中。我在网站上尝试了其他解决方案,但仍然无法正确解决。我正在使用多个模块和表单将一些信息输入到 Excel 的单元格中。但是,当 msgBox 留空时,它会给我一个 13 型不匹配错误。我尝试过 isNull 但不完全了解如何使用它。
任何帮助将不胜感激,并且请尽可能简单地回答任何问题,因为我充其量只是一个新手程序员。谢谢
Sub GetEndCostGateFees()
Dim qtyGateFees As Double
Dim msg As String
Const MinCost As Integer = 0
Const MaxCost As Integer = 200
msg = "Please enter the cost, per tonne, of Gate fees "
Do
qtyGateFees = InputBox(msg, "Gate Fees")
If IsNull(qtyGateFees) Then
MsgBox ("Please enter a value. Enter 0 if none")
End If
If IsNumeric(qtyGateFees) Then
If qtyGateFess >= MinCost And qtyGateFees <= MaxCost Then Exit Do
End If
msg = "Please enter a valid number"
msg = msg & vbNewLine
msg = msg & "Please enter number between " & MinCost & " and " & MaxCost
Loop
Sheet25.Range("B43").Value = qtyGateFees
结束子