title: Excel VBA Run-time error 13 - mismatch when box is blank
body: <p>I am stuck in VBA. I have tried other solutions on the website but still can't get it right. I am using multiple modules and forms to get some information input into cells of Excel. But, when the msgBox is left blank it gives me a type 13 mismatch error. I have tried isNull but don't fully understand how to use it.</p>
  
  <p>Any help would be much appreciated, and please keep any answers as simple as possible as I am a novice programmer at best. Thanks</p>
  
  <pre><code>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 &gt;= MinCost And qtyGateFees &lt;= MaxCost Then Exit Do
          End If
          msg = "Please enter a valid number"
          msg = msg &amp; vbNewLine
          msg = msg &amp; "Please enter number between " &amp; MinCost &amp; " and " &amp; MaxCost
          Loop
  
  Sheet25.Range("B43").Value = qtyGateFees
  </code></pre>
  
  <p>End Sub</p>