Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Removing text from Alphanumeric Values

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Removing text from Alphanumeric Values

Check one of your other posts.


Syed Rizvi wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Removing text from Alphanumeric Values

You might use this from Ron Rosenfeld and others. It will remove any text in
any position.

Sub RemoveAlpha()

Dim tbl As Range, rng As Range

With Sheets(1)
.Columns("A").NumberFormat = "@"
Set tbl = .Range("A1:A5")
End With

For Each rng In tbl
GetNumSlash rng
Next

End Sub

Public Function GetNumSlash(rng As Range) As String

Dim i As Long, sStr1 As String, sChar As String

For i = 1 To Len(rng)
sChar = Mid(rng, i, 1)
If Not sChar Like "*[!0-9]*" Then sStr1 = sStr1 & sChar
Next

rng = sStr1

End Function

Geoff

"Syed Rizvi" wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Removing text from Alphanumeric Values

Thanks very much folks, much appreciated

"Geoff" wrote:

You might use this from Ron Rosenfeld and others. It will remove any text in
any position.

Sub RemoveAlpha()

Dim tbl As Range, rng As Range

With Sheets(1)
.Columns("A").NumberFormat = "@"
Set tbl = .Range("A1:A5")
End With

For Each rng In tbl
GetNumSlash rng
Next

End Sub

Public Function GetNumSlash(rng As Range) As String

Dim i As Long, sStr1 As String, sChar As String

For i = 1 To Len(rng)
sChar = Mid(rng, i, 1)
If Not sChar Like "*[!0-9]*" Then sStr1 = sStr1 & sChar
Next

rng = sStr1

End Function

Geoff

"Syed Rizvi" wrote:

Hi
I have a column containing alphanumeric values e.g.
HG06100
H134679
HC134679
HG05534
A434340
I need a formula or macro help to remove all the text values in the cell and
leave all the numbers behind including zero. Could someone please help, thanks

Syed

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
Removing Text from Alphanumeric values Syed Rizvi Excel Discussion (Misc queries) 6 April 10th 08 05:00 PM
Removing text from Alphanumeric values Syed Rizvi Excel Worksheet Functions 1 April 10th 08 04:04 PM
VLOOKUP with numeric and alphanumeric values Dan Excel Discussion (Misc queries) 6 November 2nd 07 04:59 PM
how do i enter alphanumeric values? ECY Excel Discussion (Misc queries) 1 January 20th 06 08:46 PM
Max-function with alphanumeric values?!? Tom Excel Programming 6 December 11th 03 07:36 PM


All times are GMT +1. The time now is 06:54 AM.

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

About Us

"It's about Microsoft Excel"