View Full Version : Solved: Fill active cell's row & column

07-14-2006, 02:25 AM
I have a large spreadsheet and what I'm looking for i;
when I select a cell I'd like it's row and column to be color filled.

When I select cell E10
Row: C10:E10 color fill
Col: E4:E10 color fill

Columns A-B and rows 1-3 should always remain without filling. Appreciate some help.

07-14-2006, 02:37 AM
Add this to the worksheet change event

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' clear all existing colours
Cells.Interior.ColorIndex = 0

If Target.Row > 3 And Target.Column > 2 Then
' colour selected row and column
Target.EntireColumn.Interior.ColorIndex = 35
Target.EntireRow.Interior.ColorIndex = 35

' clear colour from rows 1-3 and column 1-2
Range("A1:A3").EntireRow.Interior.ColorIndex = 0
Range("A1:B1").EntireColumn.Interior.ColorIndex = 0
End If
End Sub

07-14-2006, 03:54 AM
Yes, that did it. Thank you.