View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Serkan Gur[_2_] Serkan Gur[_2_] is offline
external usenet poster
 
Posts: 3
Default Copy only the numbers from cells

Hi,

Write this code in a module you insert to your workbook
using VB Editor.

Public Function texttrim(a As String) As Double
Dim b As String
For i = 1 To Len(a)
If Asc(Mid(a, i, 1)) 43 And Asc(Mid(a, i, 1)) < 58 Then
b = b + Mid(a, i, 1)
Next
texttrim = b
End Function

This will make a new worksheet function =texttrim()
available in your workbook which does exactly what you
need. For example if the text to be trimmed is in cell A1,
enter =texttrim(A1) to any other cell and you will get
just the number.

Regards,

-----Original Message-----
I have some table that in one column I have some strings

(for example):
"Sum : 148,626.35 Better and different"
"Sum : 193,500.00 Osem"

I want only the number will be copy to another column.

How do I do that ?


---
Message posted from http://www.ExcelForum.com/

.