Find Alphabets & Replace With Something

dgr

Board Regular
Joined
Apr 24, 2005
Messages
176
Hi,
I'm using Excel 2013. I'm looking for a vb macro solution.

I want to find all alphabets (a-z) in a column & replace it with something else. Instead of using
Code:
Selection.Replace What:="a", Replacement:="something else", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False
26 times, is there a more elegant way to do this?

Thanks.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I'm using Excel 2013. I'm looking for a vb macro solution.

I want to find all alphabets (a-z) in a column & replace it with something else. Instead of using
Code:
Selection.Replace What:="a", Replacement:="something else", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False
26 times, is there a more elegant way to do this?
Questions...

1) Are the "alphabets" always lower (never upper) case letters?

2) What is each letter being replaced with... a single character or multiple characters?
 
Upvote 0
Thanks for your reply.

These alphabets could be a combination of lower & upper case at random. It is being replaced with nothing (I want to remove all alphabets & just allow the numbers to remain in that column).

Thanks.
 
Upvote 0
These alphabets could be a combination of lower & upper case at random. It is being replaced with nothing (I want to remove all alphabets & just allow the numbers to remain in that column).
You will need a loop. Give this a try...
Code:
For X = 65 To 90
  Selection.Replace What:=Chr(X), Replacement:="", LookAt:=xlPart, MatchCase:=False
Next
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,853
Members
449,471
Latest member
lachbee

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