Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting

Status
Not open for further replies.

willhyde

Technical User
Sep 3, 2001
29
0
0
GB
In Excel, when a cell is selected, the row and column headers are highlighted by going bold, so you can see which row and column you are in.

Is there a way of actually highlighting the entire row and column of a selected cell by changing their colour? i.e. when E6 is selected, all cells in column E and all cells in row 6 are highlighted in red, for example?

Any help gratefully received.
 
You'll need code for this:

lRow = ActiveSheet.Range("A65536").End(xlUp).Row
If ActiveCell.Row = 1 Then 'Don't do anything on header row
ElseIf ActiveCell.Row > lRow Then 'Don't do anything
'if cell is outside data range
Else
ActiveSheet.Cells.Interior.ColorIndex = xlNone
ActiveCell.EntireRow.Interior.ColorIndex = 6
Columns(ActiveCell.Column).Interior.ColorIndex = 6
End If


To be entered in the Worksheet Selection change evnt - Right click on the worksheet
choose View Code
The selection Change event is the default event and the start and end will automatically be put in place for you
Copy and paste the code above, between teh start and finish of the sub et voila
Rgds
~Geoff~
 
Excellent, that's exactly what i need.

Many thanks,

Will.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top