ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identify text type: is it a phone nuber? (https://www.excelbanter.com/excel-programming/340161-identify-text-type-phone-nuber.html)

Dave B[_3_]

identify text type: is it a phone nuber?
 
Hi, I have a large series of data in VBA that I'm trying to identify as
different types. For example, is the string a phone number? I tried
InStr(1, strMyString, "###-###-####") hoping that the #'s would serve as
wild cards. I also used * in place of the #. Neither worked. Any ideas on
how to identify whether a string is a phone number? Thanks.



Tom Ogilvy

identify text type: is it a phone nuber?
 
Use the like command

MyStr = "123-456-7890"
? mystr like "###-###-####"
True
myStr = "1234567890"
? mystr like "###-###-####"
False

--
Regards,
Tom Ogilvy


"Dave B" wrote in message
...
Hi, I have a large series of data in VBA that I'm trying to identify as
different types. For example, is the string a phone number? I tried
InStr(1, strMyString, "###-###-####") hoping that the #'s would serve as
wild cards. I also used * in place of the #. Neither worked. Any ideas

on
how to identify whether a string is a phone number? Thanks.





Vacation's Over

identify text type: is it a phone nuber?
 
In addition to Tom's comments -
you might need to determine all possible phone types depending on your source?
###.###.####
##########
international?
### ### ####


"Tom Ogilvy" wrote:

Use the like command

MyStr = "123-456-7890"
? mystr like "###-###-####"
True
myStr = "1234567890"
? mystr like "###-###-####"
False

--
Regards,
Tom Ogilvy


"Dave B" wrote in message
...
Hi, I have a large series of data in VBA that I'm trying to identify as
different types. For example, is the string a phone number? I tried
InStr(1, strMyString, "###-###-####") hoping that the #'s would serve as
wild cards. I also used * in place of the #. Neither worked. Any ideas

on
how to identify whether a string is a phone number? Thanks.







All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com