verifying data type

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want my code to look at the contents of a cell, and if the contents are not
a number (any string) execute one set of code. If the contents are a number,
skip over that code and continue on. I'm sure this can be easily done with
an If Then statement, but I don't know how to test the data type of the
contents of the cell. Could the .Type property be used? Any method for
solving this would be appreciated.
 
Try something like

If IsNumeric(Range("A1").Value) = True Then
' A1 is numeric
Else
' A1 is not numeric
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top