Need help on replace all function

mahesh8498

Active Member
Joined
Oct 4, 2007
Messages
272
Hi All,

I have 1000 country codes in column B. Before preparing final data i m everytime manually replacing country code with country name by using REPLACE ALL function.

For example : -

I have country code like US, AU, CA, IN, NZ in coulumn B and i changed US to unites states, AU to australia manually everytime.

Is there any easy way where i can replace all codes with country name at a one time???

Thanks in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You can use a macro to achieve what you want to do
Code:
Sub ReplaceAllCountryCodes()
    Dim LR&, i&
    LR = Range("B" & Rows.count).End(xlUp).Row 'Assumes your country codes are only in column B
 
    'Change 1 to your starting row whether it be 2 or 3
    For i = 1 To LR
        Range("B" & i).Value = Replace$(Range("B" & i).Value, "AU", "Australia",,,vbBinaryCompare)
        Range("B" & i).Value = Replace$(Range("B" & i).Value, "US", "United States",,,vbBinaryCompare)
        'Add more country codes in the same manner
    Next i
End Sub
 
Upvote 0
How to edit this macro for multiple column? As i have data from c to w column. and getting an error message while edditing macro. macro is allowing enter range only for 1 coloumn
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,877
Members
452,949
Latest member
Dupuhini

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