View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Extract only text from column

Perhaps this UDF (user defined function) will do what you want...

Function GetTextOnly(S As String) As String
Dim X As Long
GetTextOnly = Space(Len(S))
For X = 1 To Len(S)
If Mid(S, X, 1) Like "[!0-9]" Then Mid(GetTextOnly, X) = Mid(S, X, 1)
Next
GetTextOnly = WorksheetFunction.Trim(GetTextOnly)
End Function

In case this is a new concept for you... copy/paste the above code into the
code window for a standard Module (Insert/Module from the VB Editor's menu
bar), then just use the GetTextOnly function on a worksheet just like you
would use any other worksheet function. For example, if your text is in A1,
you could put this in your "new column" cell...

=GetTextOnly(A1)

--
Rick (MVP - Excel)


"Ryan D" wrote in message
...
How do I extract just the text portion of a column? For example if column
contains:
"123 abcd", how do I get just the "abcd" in a new column?