Link code
I would like to place code in a Module, or ThisWorkbook,
that would highlight cells with links to other places. Something like a conditional format. It should be something I can turn on, look at the cells, then turn off - don't want the highlighting permanent. What code would do this, and where would I put it? Thanks, Phil |
Link code
Phil,
One way: Place this in the sheet module: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Union(Range("a1"), Range("e1"), Range("h1")).Select With Selection If .Interior.ColorIndex = xlNone Then .Interior.ColorIndex = 6 Else .Interior.ColorIndex = xlNone End If End With End Sub Assuming that the linked cells are A1, E1, and H1 (change to your linked cells), each time you double click on this sheet, the linked cells will turn yellow. Double click again and they go back to no color. Don Pistulka "Phil Hageman" wrote in message ... I would like to place code in a Module, or ThisWorkbook, that would highlight cells with links to other places. Something like a conditional format. It should be something I can turn on, look at the cells, then turn off - don't want the highlighting permanent. What code would do this, and where would I put it? Thanks, Phil |
Link code
Phil, From the Control ToolBox put a ToggleButton on your sheet. Click the Design Mode button to made the togglebutton work. Add this code to the sheet module. Private Sub ToggleButton1_Click() Union(Range("a1"), Range("e1"), Range("h1")).Select With Selection If .Interior.ColorIndex = xlNone Then .Interior.ColorIndex = 6 Else .Interior.ColorIndex = xlNone End If End With End Sub Don Pistulka "Phil Hageman" wrote in message ... Don, Thanks for taking the time to answer my thread. Just as I clicked to send this thread, I thought how useful this could be if used as a macro, with a button/buttons on the menu bar to execute the highlight. How could I do this? -----Original Message----- Phil, One way: Place this in the sheet module: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Union(Range("a1"), Range("e1"), Range("h1")).Select With Selection If .Interior.ColorIndex = xlNone Then .Interior.ColorIndex = 6 Else .Interior.ColorIndex = xlNone End If End With End Sub Assuming that the linked cells are A1, E1, and H1 (change to your linked cells), each time you double click on this sheet, the linked cells will turn yellow. Double click again and they go back to no color. Don Pistulka "Phil Hageman" wrote in message ... I would like to place code in a Module, or ThisWorkbook, that would highlight cells with links to other places. Something like a conditional format. It should be something I can turn on, look at the cells, then turn off - don't want the highlighting permanent. What code would do this, and where would I put it? Thanks, Phil . |
All times are GMT +1. The time now is 03:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com