Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default verifying data type

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default verifying data type

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



"benb" wrote in message
...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Look up a value from a row after verifying two other values Paul W Excel Worksheet Functions 11 September 1st 08 08:59 PM
Verifying uniqueness of records in data arad Excel Discussion (Misc queries) 4 June 25th 07 05:50 PM
Verifying Dates gilbert Excel Worksheet Functions 1 September 8th 05 03:22 AM
Verifying all data in each row is filled in John[_86_] Excel Programming 1 June 9th 04 11:45 PM
verifying date MacroMan Excel Programming 0 July 30th 03 10:38 PM


All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"