# Replacing letters with numbers

#### meerkitten

##### New Member
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.
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.

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

Re: Function to replace not working

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.

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

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?

Replies
1
Views
372
Replies
1
Views
268
Replies
12
Views
2K
Replies
7
Views
434
Replies
12
Views
677

1,196,405
Messages
6,015,094
Members
441,868
Latest member
lukeskiiwalker

### 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.

### Which adblocker are you using?

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

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