Consulting

Results 1 to 3 of 3

Thread: Solved: Fill active cell's row & column

  1. #1
    VBAX Regular
    Joined
    Nov 2005
    Posts
    30
    Location

    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.

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    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]

  3. #3
    VBAX Regular
    Joined
    Nov 2005
    Posts
    30
    Location
    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
  •