Thread: formula
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
hitesh hitesh is offline
external usenet poster
 
Posts: 70
Default formula

i dont know how to make macro as iam new. so pls explain me step by step.i
think its in visul basic. pls help

"Gord Dibben" wrote:

A macro to delete all but numerics.

If you wish to retain the source cells, make a copy of the data in an adjacent
column and run the macro on that column.

Sub RemoveAlphas()
' Remove alpha characters from a string.
' except for decimal points and hyphens.
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


Gord Dibben MS Excel MVP

On Tue, 14 Nov 2006 16:30:39 +0200, "ciruliz" wrote:

Can you make VB macro, which splits up string
by Strings.split(input," ") function, array is created in result.
and then go through all elements in a loop and checks if data type is
numeric .

than you can call macro as usual excel function!

A.


"hitesh" wrote in message
...
i want to seprate the number from the sentence.
in A1 i have a sentence . anil somchand uzenwal. vartak nagar 258932.
in a2 i have sentence . sunil 34521 vartak nagar .

i want a result in cell B1 2588932
in cell B2 34521

so pls help me . i have a lot of data . i want to seprate th all number
from
th sentence. the number can be in middle or starting or the end of the
sentence.

so pls help.