Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Testing for numeric value in VBA

A string containing digits is not a number. IsNumber wil return FALSE for :

1. text strings
2. blanks
3. errors
4. Booleans (logicals)
even though TRUE is 1, IsNumber(TRUE) is false!!
5. references


Use the function and believe what it tells you.


--
Gary''s Student


"rmcompute" wrote:

I am trying to test a variable to determine if it is numeric

I typed the following in the immediate window:
mvar = 4 ?
isnumber(mvar)

Result: Sub or Function not defined.

In the program, I typed:

Dim mvar as String
mvar = "5"

Application.WorksheetFunction.IsNumber(mvar)
Result: False

mvar = "A"
Application.WorksheetFunction.IsNumber(mvar)
Result: False

Shouldn' t the test return true for 5. How can I test to determine if the
value is a number without checking if it is 0,1,2,3 etc. ?

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
Find and Return Numeric Label based on (Numeric Value) Criterion Sam via OfficeKB.com Excel Worksheet Functions 2 September 18th 06 11:20 PM
Find Numeric Criterion in Column & Return the Numeric Value from Row above Sam via OfficeKB.com Excel Worksheet Functions 6 April 27th 06 02:50 PM
Numeric in Text to convert back to the form of Numeric for VLookup Purposes achilles Excel Discussion (Misc queries) 4 February 6th 06 07:05 AM
Match Single Numeric Criteria and Return Multiple Numeric Labels Sam via OfficeKB.com Excel Worksheet Functions 3 December 30th 05 08:01 PM
Match Single Numeric Criteria and Return Multiple Numeric Labels Sam via OfficeKB.com Excel Worksheet Functions 0 December 29th 05 08:44 PM


All times are GMT +1. The time now is 07:40 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"