Is there way in Excel VBA to check if a string contains a number, and then return TRUE or FALSE. Numbers can been anywhere in the string. See example below.
![]()
Please Login or Register to view this content.
Is there way in Excel VBA to check if a string contains a number, and then return TRUE or FALSE. Numbers can been anywhere in the string. See example below.
![]()
Please Login or Register to view this content.
Last edited by mkvassh; 09-25-2009 at 08:47 AM.
Check this out
http://office.microsoft.com/en-us/ex...549011033.aspx
Shijesh Kumar
http://shijesh.wordpress.com/
With A1 containing anything.
Here are two approaches:
Non-VBA:
![]()
Please Login or Register to view this content.
Edited to include this shorter (but slightly less intuitive) alternative:
Using VBA:![]()
Please Login or Register to view this content.
Usage:![]()
Please Login or Register to view this content.
Does that help?![]()
Please Login or Register to view this content.
Last edited by Ron Coderre; 09-25-2009 at 08:27 AM.
Alternative
![]()
Please Login or Register to view this content.
I think that would return the count of digits in the referenced cell.
This would return 1 for cells containing numbers:
![]()
Please Login or Register to view this content.
yes it will return count of digits..
so we can modify it as below to return true or false
One question thousand solution ;-)![]()
Please Login or Register to view this content.
It works. Thanks a lot :-)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks