Replacing letters with numbers

meerkitten

New Member
Joined
May 28, 2015
Messages
3
Currently, the macro I have recognizes cells that have errors in which letters have replaced numbers. For example, a cell might have 2B,498 instead of 28,498. How do I replace all the "B"s with "8"s specific columns of the spreadsheet???
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Assuming you are only interested in correcting Column A then u use something like this:

Code:
Sub Macro1()
    Range("A:A").Replace What:="O", Replacement:="0", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Range("A:A").Replace What:="B", Replacement:="8", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub

You will need to add the list of possible corrections tho.
 
Upvote 0
Function to replace not working

I have to replace "B"s with "8"s in specific columns where 188 might have become 1BB or 18B. I have written my code as seen below but it does not work. What is missing?
Sub Macro1()
Range("F:R").Replace What:="O", Replacement:="0", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Range("F:R").Replace What:="B", Replacement:="8", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub
 
Upvote 0
Re: Function to replace not working

I have moved your reply back to the thread with your original question.

All replies, clarifications, or directly related follow-ups to a specific question should be posted back to the original thread. Only start a new thread if you have a new question.

Regarding your question, I tested the code, and it seems fine to me. If it is not working for you, please provide a specific example, i.e. tell us a value which is not updating and which cell this value is found in.
 
Upvote 0
Re: Function to replace not working

For example, cell G10 contains the value 4B.O and will not convert the B to 8 or O to 0
 
Upvote 0
Re: Function to replace not working

It converts the entry to "48" for me.

How exactly are you running this code?
Have you placed it in a generic module, or a sheet module?
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,705
Members
449,048
Latest member
81jamesacct

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