Colour the active row, then remove colouring when row is non
Prep for a pre-employment Excel test with Job Test Prep
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Colour the active row, then remove colouring when row is non

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Adelaide, Australia
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    How can I colour the active row, then remove colouring and apply it to another row when focus moves?

  2. #2
    MrExcel MVP Tom Urtis's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, California USA
    Posts
    11,136
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Right click on your sheet tab, left click on View Code, and paste this in. It will hilite your selected row in blue. Modify for color index number.

    Sub Worksheet_SelectionChange(ByVal Target As Range)
    Cells.Interior.ColorIndex = 0
    Target.EntireRow.Interior.ColorIndex = 8
    End Sub

    Tom Urtis

  3. #3
    New Member
    Join Date
    Feb 2002
    Location
    Washington State
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Right click on your sheet tab, left click on View Code, and paste this in:

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    Cells.Interior.ColorIndex = -4142
    Target.EntireRow.Interior.ColorIndex = 8
    End Sub

    This will color the row you are in with a shade of blue.

    or

    If you want it to apply to all the worksheets in the workbook then right click on the excel icon next to FILE on the toolbar, left click on View Code and paste the following in:

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
    Cells.Interior.ColorIndex = -4142
    Target.EntireRow.Interior.ColorIndex = 8
    End Sub


    Rick

  4. #4
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Note of caution - this can slow down your spreadsheet and you lose any colouring you already might have had in that row.
    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  5. #5
    New Member
    Join Date
    Nov 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    sorry for being nosey but what did you use this for? its good and i was wondering how i could incorporate it into an it project for my college work. thanx Gem

  6. #6
    Board Regular Iridium's Avatar
    Join Date
    Jul 2002
    Location
    Walsall, England
    Posts
    2,831
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    For info a HOF winner

    http://www.mrexcel.com/hof001.php

    Any good to you?
    Iridium


  7. #7
    New Member
    Join Date
    Nov 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    yep, cheers! xx

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com