• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 69
  • Last Modified:

VBA replace kind of macro

Hi Experts

Can there be way or macro be written where search is made to the whole sheet and whereever the following left contents are found they are get replaced by the right hand side contents.

Code                        Description
DK, R                       Dinesh Kumar, Rakesh
R, KD                       Rakesh, Kumar Dinesh
A,B,C,D&E              Apple,Ball,Cat, Dog & Egg
A78GHj                  North America

There are almost 100 codes which I need to replace.

Please note above DK, R are two codes as they are separated by comma so they will be replaced by Dinesh Kumar, Rakesh
similarly A78GHj,A78GHj will get repalced by North America, North America
0
Dinesh Kumar
Asked:
Dinesh Kumar
1 Solution
 
Rgonzo1971Commented:
Hi,

Your codes are non unique:
You have A
in A,B,C,D&E              Apple,Ball,Cat, Dog & Egg
and A in
 A78GHj

I do not see how to differentiate between them

Regards
0
 
KoenCommented:
@rgonzo, no he doesnt... the first code is A followed by a comma..; the second is A78GHj; -> two different codes...
1
 
Dinesh KumarAuthor Commented:
Yes..

A,B, A78GHj

These can be considered three different codes.

to clarify more. A can be found in 2 cells so we need to replace these 2 occurrences of A separately. similarly a cell can contains 10 codes separated by comma.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Rgonzo1971Commented:
but when you see kd and dk  they do not have separators
0
 
Dinesh KumarAuthor Commented:
kd and dk are two codes.
0
 
Dinesh KumarAuthor Commented:
kd will be replaced by some string..e.g. Kumar Dinesh
0
 
Ejgil HedegaardCommented:
Try attached.
On sheet List are the replacement list.
ID in column A, and the replacement in column B.
Add other replacements below, no empty cells in the list.
Press button to run.

It is exact character match so A is not equal to a.
ReplaceID.xlsm
0
 
aikimarkCommented:
Please post a sample workbook
0
 
Dinesh KumarAuthor Commented:
I am trying the solution posted by experts.. let me update by monday next.
0
 
Dinesh KumarAuthor Commented:
perfect, thank you so much.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now