Highlight Excel Cell by Selecting Different C

April 29, 2009 at 08:26:17
Specs: Windows Vista
I want to Highlight Excel Cell by Selecting Different Cell. For example:

Highlight cell H3 When Cell A3 is selected.

But i need to use this method for many other cells.

any ideas?


See More: Highlight Excel Cell by Selecting Different C

Report •

April 29, 2009 at 09:11:53
I'm not sure if the act of simply selecting a cell and having the color of a second cell change, is possible.
Maybe with some VBA code.

But you might look at Conditional Formatting
It may be what your looking for.



Report •

April 29, 2009 at 10:43:40
If there is some sort of "pattern" to the selected/highlighted cells then it could be done with the following code. The pattern I'm assuming here is that the cell you want highlighted is 7 columns away. i.e. A - H

You will also lose the use of one cell as it is required to store the highligthed cell's address so it can turn off the highlighting when you mkae your next selection.

Try this code and if it's even close, let me know what else you need.

Private Sub Worksheet_SelectionChange(ByVal target As Range)
On Error Resume Next
'Get address to reset highlighting
  oldTarget = Range("A1")
'Reset highlighting
  Range(oldTarget).Interior.ColorIndex = xlNone
'Highlight cell 7 columns to the right
  target.Offset(0, 7).Interior.ColorIndex = 6
'Store highlighted cell address for use next time
 Range("A1") = target.Offset(0, 7).Address
End Sub

Report •

Related Solutions

Ask Question