+ Reply to Thread
Results 1 to 2 of 2

Compare strings in cells and highlight difference

  1. #1
    Odin
    Guest

    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


  2. #2
    Stefi
    Guest

    RE: 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
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1