+ Reply to Thread
Results 1 to 13 of 13

Highlight cell when source file is updated

  1. #1
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Highlight cell when source file is updated

    Hi, I have many cells in Excel file A that are linked to Excel file B (source file). Is it possible for Excel to auto-highlight/color the affected cells in file A when the numbers in file B changes ? I have tried using Private Sub Worksheet_Change(ByVal Target As Range) and Private Sub Worksheet_Calculate() without any success.

    I'm not trained in any programming language hence please use simple terms. Thanks !

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Highlight cell when source file is updated

    hi ChinShiong,
    This may do the trick.
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Highlight cell when source file is updated

    Thanks for the reply pike, but it doesn't work. Maybe I'm doing something wrong ?

    I opened Excel file A, right click on the sheet name, click "view code", and pasted the code there, and saved the file.

    Then I open the source file and changed the value. When I opened file A again to update the links to file B, the numbers are updated, but the font doesn't get highlighted to red. Any thoughts on this ?

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Highlight cell when source file is updated

    no it was just a long shot
    but ill look into it

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Highlight cell when source file is updated

    The Change event won't be triggered by a formula, so you would have to use the Calculate event, but that doesn't provide a Target argument telling you what (if anything) changed, so you would have to store the old values of every cell you were interested in and then check all of them whenever the sheet recalculates. This would probably be quite processor intensive (depending on amount of data and how many cells you want to monitor) and might slow your worksheet down too much. How many cells do you want monitored?
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Highlight cell when source file is updated

    I'm looking at hundreds of linked cells.

    So the only solution is to break the link for the old file, and run an update for the new file and do a comparison ?

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Highlight cell when source file is updated

    I'm not really sure what you mean by "break the link and run an update"?

  8. #8
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Highlight cell when source file is updated

    Breaking a link:
    \1

    Update:
    \1

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Highlight cell when source file is updated

    Hi ChinShiong,
    What about a hidden sheet that when the file is closed copies the Link values and resets the link font colour to black. Then when the file is re-opened, if the values in the Linked cells don't equal the hidden sheet values they change colour?

  10. #10
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Highlight cell when source file is updated

    Hi pike,

    That's a great idea. Initially I was thinking of having many sheets, 1 sheet to contain each page of the info that I want linked, but I guess I could do with only 1 sheet for all the info.

    Would you have the code for that ?

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Highlight cell when source file is updated

    Hi ChinShiong,
    Something along the line of....
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    05-10-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Highlight cell when source file is updated

    Hi pike, the code doesn't work for me. For the first part, I copy and paste as a macro code, and I'm able to get it to copy and paste values for cell A8 only, after removing the font color line. Possible to copy the entire sheet ?
    Sub Macro1()
    With Sheets("Sheet1").Range("A8")
    .Copy
    Sheets("Sheet3").Range("A8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

    End With
    End Sub
    For the second code, I'm able to get it to work as a macro, but it only compares the value in cell A8. Able to compare between entire sheets ?

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Highlight cell when source file is updated

    Hi ChinShiong
    Just so happens I found an example to compare worksheets here in the excel tips
    http://www.exceltip.com/st/Compare_t...Excel/477.html

+ 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