title: Check if cell is a number in Excel VBA
body: <p>in the code below, I am working on doing numeric calculations on cells.  Sometimes though, one of the cells(say for example the"LosLimit") may contain a non-numeric value like "---".  How do I check if the cell is numeric or not.  </p>
  
  <p>If it is a number, then do calculation, else return value from "MeasValue"</p>
  
  <pre><code>Sub ReturnMarginal()
  
      'UpdatebySUPERtoolsforExcel2016
      Dim xOut As Worksheet
      Dim xWb As Workbook
      Dim xWks As Worksheet
      Dim InterSectRange As Range
      Dim lowLimCol As Integer
      Dim hiLimCol As Integer
      Dim measCol As Integer
  
      Application.ScreenUpdating = False
      Set xWb = ActiveWorkbook
      For Each xWks In xWb.Sheets
          xRow = 1
          With xWks
             FindString = "LowLimit"
             If Not xWks.Rows(1).Find(FindString) Is Nothing Then
                 .Cells(xRow, 16) = "Meas-LO"
                 .Cells(xRow, 17) = "Meas-Hi"
                 .Cells(xRow, 18) = "Min Value"
                 .Cells(xRow, 19) = "Marginal"
                 LastRow = .UsedRange.Rows.Count
                 lowLimCol = Application.WorksheetFunction.Match("LowLimit", xWks.Range("1:1"), 0)
                 hiLimCol = Application.WorksheetFunction.Match("HighLimit", xWks.Range("1:1"), 0)
                 measLimCol = Application.WorksheetFunction.Match("MeasValue", xWks.Range("1:1"), 0)
                  .Range("P2:P" &amp; lastRow).Formula = "=IF(ISNUMBER(" &amp; .Cells(2, lowLimCol).Value2 &amp; ")," &amp; Cells(2, measLimCol).Address(False, False) &amp; "-" &amp; Cells(2, lowLimCol).Address(False, False) &amp; "," &amp; Cells(2, measLimCol).Address(False, False) &amp; ")"
  
  
                 .Range("Q2:Q" &amp; LastRow).Formula = "=" &amp; Cells(2, hiLimCol).Address(False, False) &amp; "-" &amp; Cells(2, measLimCol).Address(False, False)
  
                 .Range("R2").Formula = "=min(P2,Q2)"
                 .Range("R2").AutoFill Destination:=.Range("R2:R" &amp; LastRow)
  
                 .Range("S2").Formula = "=IF(AND(R2&gt;=-3, R2&lt;=3), ""Marginal"", R2)"
                 .Range("S2").AutoFill Destination:=.Range("S2:S" &amp; LastRow)
  
             End If
  
          End With
          Application.ScreenUpdating = True 'turn it back on
      Next xWks
  
  End Sub
  </code></pre>