replace contents of cells with number value rather than letter help - Excel 2010

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, Is there a quick way to replace multiple cells in a column, say column A. that have the letter "x" and replace it with the number 1? Cant get this to work, please help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hello, Is there a quick way to replace multiple cells in a column, say column A. that have the letter "x" and replace it with the number 1? Cant get this to work, please help.

Never mind I figured out a way to do it.
 
Upvote 0
Hello, Is there a quick way to replace multiple cells in a column, say column A. that have the letter "x" and replace it with the number 1? Cant get this to work, please help.

This function should do it and you can use it as a formula or bolt-on code to a recursive sub routine.

Code:
Function RemoveVowels(Txt) As String
' Removes all vowels from the Txt argument
    Dim I As Long
    RemoveVowels = ""
    For I = 1 To Len(Txt)
        If Not UCase(Mid(Txt, I, 1)) Like "[x]" Then
            RemoveVowels = RemoveVowels & "1" & Mid(Txt, I, 1)
        End If
    Next I
End Function
Code:
Sub ZapTheVowels()
    Dim UserInput As String
    
    UserInput = InputBox("Enter some text:")
    MsgBox RemoveVowels(UserInput), , UserInput
End Sub
 
Upvote 0
Simplest method: Click the HOME tab. Click the FIND & SELECT option. Click REPLACE. Put "X" in the FIND WHAT box. Put "1" in the REPLACE WITH box. Click REPLACE ALL.
 
Upvote 0
This function should do it and you can use it as a formula or bolt-on code to a recursive sub routine.

Code:
Function RemoveVowels(Txt) As String
' Removes all vowels from the Txt argument
    Dim I As Long
    RemoveVowels = ""
    For I = 1 To Len(Txt)
        If Not UCase(Mid(Txt, I, 1)) Like "[x]" Then
            RemoveVowels = RemoveVowels & "1" & Mid(Txt, I, 1)
        End If
    Next I
End Function
Code:
Sub ZapTheVowels()
    Dim UserInput As String
    
    UserInput = InputBox("Enter some text:")
    MsgBox RemoveVowels(UserInput), , UserInput
End Sub

Thanks, I'll check it out tomorrow. I appreciate it.
 
Upvote 0
Simplest method: Click the HOME tab. Click the FIND & SELECT option. Click REPLACE. Put "X" in the FIND WHAT box. Put "1" in the REPLACE WITH box. Click REPLACE ALL.

new it had a simple answer. Thanks for the reply. I appreciate it.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top