Thread: Reformat Number
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Reformat Number

? StripNonChar("!@#$%^1234590ABCD abxyz&*(){}")
1234590ABCDabxyz


Public Function StripNonChar(s)
Dim s1 As String
Dim i As Long, schr As String

For i = 1 To Len(s)
schr = UCase(Mid(s, i, 1))
If IsNumeric(schr) Or (schr = "A" And schr <= "Z") Then
s1 = s1 & Mid(s, i, 1)
End If
Next
StripNonChar = s1
End Function

--
Regards,
Tom Ogilvy



wrote in message
oups.com...
I am extracting data from a program that collects project data in a
number of areas.
The project number is extracted just as it comes out of the program,
sometime with parentheses , commas, or dashes in between its parts.
The field the number is input into is a text field.

What I would like to do is to remove all symbols from the number and
make the number one long string of digits. Is there any way to do
this?

Thanks in advance for the help.