Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Reformat Number

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Reformat Number

Hi,
Try:

Sub RemoveNonNumeric()

Dim projnum as string, newprojnum as string

projnum = "123(45-*Ab345]"
newprojnum = ""

For i = 1 To Len(projnum)
If IsNumeric(Mid(projnum, i, 1)) Then newprojnum = newprojnum + Mid(projnum,
i, 1)
Next i
MsgBox newprojnum
End Sub

" wrote:

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Reformat joe925c New Users to Excel 2 February 9th 09 08:45 PM
Reformat numbers EllenM Excel Discussion (Misc queries) 6 August 8th 07 04:22 PM
Reformat of a table [email protected] Excel Discussion (Misc queries) 2 December 7th 06 04:02 AM
Reformat existing 4 digit number as hh:mm? Carol Wolfe Excel Programming 5 April 6th 05 07:57 AM
reformat numbers waterman Excel Programming 1 April 28th 04 02:41 AM


All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"