IsNumber "Sub or function not defined"

Glory

Well-known Member
Joined
Mar 16, 2011
Messages
640
IsNumber is listed in VBA's help as one of the "worksheet functions available to VBA", but when I try to use it, an error message appears.

What code do I use to determine whether a string contains one type of data or another?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The VBA native IsNumeric function will tell you if a string can be converted to a number.

To use IsNumber (which does not tell you the same thing), you need to apply as WorksheetFunction.IsNumber
 
Upvote 0
Is that what i want to use in order to check to make sure that a user has inserted the right kind of information in a field?

I want to check to see whether a date actually consists of numbers or if the user has accidentally inserted a letter. I'm going to split the date at the delimiters and use "IsNumeric"?

What if I needed to make sure it was a bunch of letters?
 
Upvote 0
Also, what does it mean to say that a "worksheet function" is "available to VBA", if not that those functions can be used in VBA?
 
Upvote 0
The native IsDate function will tell you if a string can be converted to a date and/or time.
 
Upvote 0
Also, what does it mean to say that a "worksheet function" is "available to VBA", if not that those functions can be used in VBA?
They can be used, Glory, but you need to preface it:

Code:
mySum = WorksheetFunction.Sum(Range("A1:A10").Value)
 
mySum = WorksheetFunction.Sum(myArray)
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top