Remove numbers from string

Routine #9 from our series of text subroutines to use in EXCEL to remove all numbers from a string. When applied to a range it will remove all numbers from selected cells.

Code snippet below:

Sub remove_numbers_from_string() 'remove all numbers from string
Dim selected_range As Range
Set selected_range = Range(Selection.Address)
Dim i As Integer
Dim first_word As String

Dim old_value As String
For Each cell In selected_range
 For i = 0 To 9
 old_value = vbNullString: old_value = cell.Value
 cell.Value = Replace(old_value, i, "")
End Sub

You can see how to add this to Excel in order to use the code in this thread UPPER CASE


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>