LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Gord Dibben
 
Posts: n/a
Default

Bhupinder

OK with a macro?

Sub RemoveAlphas()
'' Remove alpha characters from a string.
Dim intI As Integer
Dim rngR As Range, rngRR As Range
Dim strNotNum As String, strTemp As String

Set rngRR = Selection.SpecialCells(xlCellTypeConstants, _
xlTextValues)

For Each rngR In rngRR
strTemp = ""
For intI = 1 To Len(rngR.Value)
If Mid(rngR.Value, intI, 1) Like "[0-9.]" Then
strNotNum = Mid(rngR.Value, intI, 1)
Else: strNotNum = ""
End If
strTemp = strTemp & strNotNum
Next intI
rngR.Value = strTemp
Next rngR
End Sub

Note: this will alter the original data with no undo. May be best to try it
on a copy of your worksheet if you want to preserve original data.


Gord Dibben Excel MVP

On Wed, 28 Sep 2005 07:09:06 -0700, Bhupinder Rayat
wrote:

Hi all,

is it possilble to extract integers from a text string within a cell?

Eg.
Cell A1 - "ABC 123"
I want to extract the "123" from cell A1.

I have many text strings from which I need to extract the integers from.
The trouble is that each text string does not follow a consistent order, so I
cannot use text functions such as LEFT, MID or RIGHT to extract what i need.

Any help would be much appreciated.


Regards,


Bhupinder Rayat


 
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
can you find specific text in a string ignoring any other text chriscp Excel Discussion (Misc queries) 1 September 18th 05 09:54 PM
Extracting text from a cell entry morchard Excel Discussion (Misc queries) 2 July 6th 05 03:53 PM
how do I remove empty spaces trailing a text string? Need_Help Excel Worksheet Functions 2 June 7th 05 12:13 AM
Extracting Surname from within a text string Iainkerr01 Excel Worksheet Functions 6 March 14th 05 10:16 AM
Formating a text string? METCO1 Excel Discussion (Misc queries) 2 November 30th 04 06:31 PM


All times are GMT +1. The time now is 06:40 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"