ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hyperlink box color (https://www.excelbanter.com/excel-discussion-misc-queries/247057-hyperlink-box-color.html)

Laurie@mtb

Hyperlink box color
 
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

Tom Hutchins

Hyperlink box color
 
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/200...e-elses-macro/

Hope this helps,

Hutch

"Laurie@mtb" wrote:

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



All times are GMT +1. The time now is 10:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com