0

I have the below code that's returning a mismatch error when the value isn't numerical. What would I change?

If Sheet3.Cells(4, 8).Value <= 182 Then
    Call ThreeSpells
End If

Thanks in advance :)

Shaun Casey
  • 69
  • 1
  • 6

1 Answers1

1

Something like this

Dim MyVar, MyCheck
MyVar = Sheet3.Cells(4, 8).Value
MyCheck = IsNumeric(MyVar) 'Returns True

If MyCheck = True Then
  If Sheet3.Cells(4, 8).Value <= 182 Then
     Call ThreeSpells
  End If
Else
 'msgbox or what you want
End If
Kᴀτᴢ
  • 2,146
  • 6
  • 29
  • 57
  • Sorry if I've missed something but where does the above code check if the cell value is equal to or less than 182? – Shaun Casey May 07 '15 at 12:42
  • 2
    You could condense the code in your answer: `If IsNumeric(Sheet3.Cells(4, 8).Value Then...` – EngJon May 07 '15 at 12:53