PDA

View Full Version : Delete all character in column



da_phat
11-18-2008, 08:29 PM
hi,
i looking for a a vba codes or way on how can i remove all the character in the column and leave only the numbers.Thanks

MaximS
11-18-2008, 09:14 PM
can you give an example of string which needs to be proccessed?

MaximS
11-18-2008, 09:34 PM
try this:


Sub number_collector()

Dim x, y As String

For i = 1 To 5
For j = 1 To Len(Cells(i, 1))

x = Mid(Cells(i, 1), j, 1)

If x > Chr(47) And x < Chr(58) Or x = Chr(44) Or x = Chr(46) Then

y = y + x

Else

If y <> "" Then

GoTo Jump:

End If

End If

Next j
Jump:
Cells(i, 2).Value = y
y = ""
Next i
End Sub

da_phat
11-19-2008, 03:31 PM
thanks a lot.Sorry can't reply you quickly...but the code does help..thanks again