View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Efficient way to drtermine if a string contains digits?

I like the first approach. The 2nd one is not very flexible, say if you
wanted to add a period or other misc chars.


Just add them to the list. For example... period, comma, equal sign, dash:

Const CharsAllowed = "0-9.,=-"

Another example... is there a Hex digit in the string (upper or lower case
letters permitted):

Const CharsAllowed = "0-9A-Fa-f"

The use of ranges can cut down on typing lots of characters.

Rick