A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Insert a module in the Visual Basic Editor, and copy the following code into the module:
Function StripString(s As String) As String
Dim t As String
Dim i As Long
Dim c As String
For i = 1 To Len(s)
c = Mid(s, i, 1)
If UCase(c) >= "A" And UCase(c) <= "Z" Then
t = t & c
End If
Next i
StripString = t
End Function
You can use this function in VBA, for example
Debug.Print StripString("30 ABC30")
will return ABC in the Immediate window.
You can also use the function in a worksheet formula. For example, if cell A1 contains the string "30 ABC30", the formula =StripString(A1) in another cell (for example B1) will return "ABC" (without the quotes).