Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default To have an entire row highlighted to some color if any cell in that row is selec

Can someone help me please? I'm trying to find a way to
have an entire row highlight to some color if any cell in
that row is selected.
I have the following information (not sure if it is
correct), but I have no idea how to use it. Is it a macro?
visual basic? Help!

Private Sub Worksheet_SelectionChange(By Val Target As
Excel.Range)
Static oldRange as Range
Static colorIndices(256) As Integer
Dim i As Integer
If Not oldRange Is Nothing Then 'Restore color indices
For i=1 to 256
Cells(oldRange.row,
i).Interior.ColorIndex=colorIndices(i)
Next i
End If
For i = 1 to UBound(colorIndices)
colorIndices(i)=Cells(ActiveCell.row,i).Interior.C olorIndex
Next i
ActiveCell.EntireRow.Interior.ColorIndex=15
Set oldRange=ActiveCell.EntireRow
End Sub

Thank you!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default To have an entire row highlighted to some color if any cell in that row is selec

Nick,

It's worksheet event code, so it goes into the worksheet code module. To get
at this, right-click on the sheet name tab, select View Code from the menu,
and then paste the code into the code pane that pops up.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nick" wrote in message
...
Can someone help me please? I'm trying to find a way to
have an entire row highlight to some color if any cell in
that row is selected.
I have the following information (not sure if it is
correct), but I have no idea how to use it. Is it a macro?
visual basic? Help!

Private Sub Worksheet_SelectionChange(By Val Target As
Excel.Range)
Static oldRange as Range
Static colorIndices(256) As Integer
Dim i As Integer
If Not oldRange Is Nothing Then 'Restore color indices
For i=1 to 256
Cells(oldRange.row,
i).Interior.ColorIndex=colorIndices(i)
Next i
End If
For i = 1 to UBound(colorIndices)
colorIndices(i)=Cells(ActiveCell.row,i).Interior.C olorIndex
Next i
ActiveCell.EntireRow.Interior.ColorIndex=15
Set oldRange=ActiveCell.EntireRow
End Sub

Thank you!





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can the cell the cursor is on be highlighted a different color ? Sally Excel Discussion (Misc queries) 1 July 29th 09 06:10 PM
Highlighted cell color JP[_6_] Excel Worksheet Functions 1 November 19th 08 09:39 PM
Having an entire row highlighted as I move from cell to cell Luthdawg Excel Discussion (Misc queries) 8 October 2nd 08 05:25 PM
preventing the color in a highlighted cell from printing Sally M Excel Discussion (Misc queries) 2 December 17th 07 01:39 PM
highlighted cell color kdadman Setting up and Configuration of Excel 4 May 24th 07 06:38 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"