+ Reply to Thread
Results 1 to 4 of 4

VBA code to highlight individual changed words within Cells

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    VBA code to highlight individual changed words within Cells

    Does anyone know if there is VBA code to highlight individual words that have changed in cells between 2 versions of the same sheet? I found code that highlights the whole cell where changes have been made (where the result sheet is named "Def" and the Original sheet is named "Abc") as follows :

    Sub comparesheets()
    For Each cl In Sheets("Def").UsedRange
    If cl.Value <> Sheets("Abc").Cells(cl.Row, cl.Column) Then
    cl.Font.Color = RGB(0, 0, 255)
    End If
    Next cl
    End Sub

    ...But I would like to show the actual change in colour rather than the whole cell. e.g. if cell A1 on sheet "Abc" shows "Heathrow Gate 24" and A1 on sheet "Def" has been change to "Heathrow Gate 32", I want A1 on "Def" to show as "Heathrow Gate 32"

    Any ideas?

  2. #2
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: VBA code to highlight individual changed words within Cells

    try this
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA code to highlight individual changed words within Cells

    Kalak

    Many thanks for your suggestion - I just need a small "tweak" to the code. I think the "mid" statement needs to be changed slightly and I am not sure how. Certain letters in the amended sheet do not show in colour if they exist in the original text - for example if "Heathrow Gate" was changed to "Heathrow Lane" the "L" and the "n" in Lane would appear in colour but "a" and "t" would not as they existed in the original word. Is there a way that the whole words can be coloured if the word is changed?

    Apologies for the delay in replying - I have rarely used this site and thought I had replied to the thread yesterday but nothing appeared, hence the reply here.

    Many thanks M

  4. #4
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: VBA code to highlight individual changed words within Cells

    this is only lightly tested, and may need some modification.
    but I'm out of time now, so test it anyway and see if it does OK or not
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 07-09-2013, 01:00 PM
  2. [SOLVED] Highlight cells when value is changed by user and/or formula
    By mmogharreban in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-10-2013, 12:39 PM
  3. Need to highlight particular words in different cells
    By Tannerx007 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-10-2012, 03:58 PM
  4. Replies: 2
    Last Post: 05-06-2011, 09:14 AM
  5. Looking for code to automatically highlight cells yellow as they are changed.
    By trickyricky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2011, 01:49 AM

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