![]() |
Compare strings in cells and highlight difference
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 |
Compare strings in cells and highlight difference
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: 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 |
All times are GMT +1. The time now is 12:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com