![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Adelaide, Australia
Posts: 182
|
How can I colour the active row, then remove colouring and apply it to another row when focus moves?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,382
|
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 |
|
New Member
Join Date: Feb 2002
Location: Washington State
Posts: 33
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
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 |
|
New Member
Join Date: Nov 2002
Posts: 8
|
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 |
|
Board Regular
Join Date: Jul 2002
Location: West Bridgford, Notts., England
Posts: 2,835
|
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Nov 2002
Posts: 8
|
yep, cheers! xx
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|