Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting only text from cell in Excel VBA 1

Status
Not open for further replies.

wwgmr

MIS
Mar 12, 2001
174
US
Hi,

Is there way to extract just the text from cell? There maybe spaces between words.

Thanks

I know this should be easy but I am not finding it right now. lol
 
Forgot to mention that the cell may or may not have a number value before the text.
 
Code:
Function AlphaOnly(sStr As String) As String
    Dim sByte As String
    For i = 1 To Len(sStr)
        sByte = Mid(sStr, i, 1)
        Select Case sByte
        Case "a" To "z", "A" To "Z"
            AlphaOnly = AlphaOnly & sByte
        End Select
    Next
End Function
Use on spreadsheet as a user-defined function or in VBA code. :)

Skip,
Skip@TheOfficeExperts.com
 
I do need the spaces Skip as they maybe two words in the cell. I was trying to do a instrrev to start from left and move across cell looking for maybe " " a double space but I didn't seem to write that correct.

So I do want to include the spaces in it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top