-
Solved: Fill active cell's row & column
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.
Example:
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.
-
Add this to the worksheet change event
[vba]
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
[/vba]
-
Yes, that did it. Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules