Consulting

Results 1 to 4 of 4

Thread: Solved: Highlight cell from link

  1. #1

    Solved: Highlight cell from link

    Hello

    I use Excel 2003.

    In a workbook, I have 2 sheets. I link some cells in the Sheet2 with cells from Sheet1. (Paste as Link)

    I'm searching a way to "Highlight" the cells in Sheet1 when a link to this cell exist in Sheet2.
    Just to be sure that I don't forget to link a cell from Sheet1.
    (So Sheet1 is the source and Sheet2 the destination)

    If in a cell of Sheet2, I have : "=Sheet1!$B$25" , I would like that the cell "B25" in Sheet1 have a different background colour by example or whatever as long as I can distinguish it

    Do you think it's possible ?

    Thanks in advance for your help

    ericc

  2. #2
    VBAX Regular
    Joined
    Jan 2009
    Posts
    93
    Location

    Smile Color formula in List1 from List1 on List2

    Hi, this code works if it is simple formula as You mentioned "=Sheet1!$B$25"

    on more complex formula necessary to developed further check

    wish You GOOD LUCK and good night,

    Pavel Humenuk



    Sub color()

    Sheets("List1").Cells.Interior.ColorIndex = xlNone

    Cells.Select
    Selection.SpecialCells(xlCellTypeFormulas, 23).Select

    If Not Selection Is Nothing Then
    For Each cell In Selection
    MsgBox cell.Formula
    MsgBox "address of formula " & cell.Address(0, 0), , _
    cell.Parent.Name
    MsgBox Len(cell.Formula)
    MsgBox Mid(cell.Formula, 8, Len(cell.Formula))

    If Mid(cell.Formula, 1, 7) = "=List1!" Then
    MsgBox cell.Formula
    Sheets("List1").Range(Mid(cell.Formula, 8, Len(cell.Formula))).Interior.ColorIndex = 6
    Else
    End If

    Next
    End If

    'Range("A1").Select
    Application.Goto Reference:="R1C1"

    End Sub

  3. #3

    Thumbs up

    Excellent !!
    This is exactly what I need

    Thank you

    ericc

  4. #4
    VBAX Regular
    Joined
    Feb 2009
    Posts
    29
    Location
    I know its solved already, but I thought I'd edit hardlife's version so the user does not need to click through numerous message boxes to highlight the cells. Hope this helps.


    [vba]
    Sub color()
    Sheets("List1").Cells.Interior.ColorIndex = xlNone
    Sheets("List2").Activate
    Cells.Select
    Selection.SpecialCells(xlCellTypeFormulas, 23).Select
    If Not Selection Is Nothing Then
    For Each cell In Selection
    If Mid(cell.Formula, 1, 7) = "=List1!" Then

    Sheets("List1").Range(Mid(cell.Formula, 8, Len(cell.Formula))).Interior.ColorIndex = 6
    Else
    End If
    Next
    End If
    Application.GoTo Reference:="R1C1"
    End Sub
    [/vba]
    REVISED -original code written by hardlife

Posting Permissions

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