MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Remove specified characters from a text string

Posted by Mike on February 05, 2002 1:58 AM

Is there any way I can simply remove certain characters from a text string. For example, I have a post code BN19 4GX and I want to remove all numeric charaters to leave BN GX.

Cheers all


Posted by Juan Pablo G. on February 05, 2002 4:35 AM

Paste this UDF in a module, and use it in Excel like this.


where A1 houses 'BN19 4GX'

Function RemoveNumeric(Rng As String) As String
Dim Tmp As String
Dim i As Integer

Tmp = Rng
For i = 0 To 9
Tmp = Application.Substitute(Tmp, i, "")
Next i
RemoveNumeric = Tmp
End Function

Juan Pablo G.