Hyperlink box color

  • Thread starter Thread starter Laurie@mtb
  • Start date Start date
L

Laurie@mtb

In Microsoft excel 2007 I have spreadsheet with hyperlinks to another page
and I would like the hyperlinked cell to be highlighted when I click on the
link. Thanks
 
Do you mean you want to highlight the cell the hyperlink jumps to? Try the
following event code...

Option Explicit

Public PrevCell As Range

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
On Error Resume Next
Dim c As Range
If Target.Hyperlinks.Count > 0 Then
Set c = Range(Target.Hyperlinks(1).Range)
c.Interior.ColorIndex = 6
PrevCell.Interior.ColorIndex = xlColorIndexNone
Set PrevCell = c
End If
End Sub

I used ColorIndex 6, which is bright yellow. Change it to whatever you like.

This code needs to be pasted into the ThisWorkbook module of your workbook
in the Visual Basic Editor. If you are new to macros, this link to Jon
Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/

Hope this helps,

Hutch
 
Back
Top