Compare strings in cells and highlight difference

O

Odin

I am new to Macros and I have failed to write one to compare 2 cells
and highlight the difference between the strings in those cells. The
one tried highlighted the whole cell instead.

Compare string in column B to Column A and return the different
character in column C and the position of that character in column D.
This must be possible for multiple characters/positions. Is it possible
to highlight (bold/different colour) the different character as well.
For example:-

A B C D
1 A6ABC A67ABC 7 3
2 A7ABC A557ABC 5, 5 2, 3
3 12AAC R126AAC R, 6 1, 4
4 D4CBT LF04CBT L, F,0 1, 2, 3
5 2811D 28MD M 3


Thanking you in advance,

Odin
 
S

Stefi

Hi odin,

For the first row in your example the code is this:

Range("B1").Select
ActiveCell.Characters(Start:=Range("D" & ActiveCell.Row),
Length:=1).Font.FontStyle = "Bold"

Try to write a macro based on this code to do the whole job!

Regards,
Stefi

„Odin†ezt írta:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top