ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Highlight entire rows as I scroll? (https://www.excelbanter.com/excel-discussion-misc-queries/27019-highlight-entire-rows-i-scroll.html)

blackrb1

Highlight entire rows as I scroll?
 
As I scroll down the rows in Excel, the row number and the current cell are
highlighted. Is there a way to have the entire row be highlighted as I
scroll?


Hi
Have a look here for an option:
http://www.cpearson.com/excel/RowLiner.htm

--
Andy.


"blackrb1" wrote in message
...
As I scroll down the rows in Excel, the row number and the current cell
are
highlighted. Is there a way to have the entire row be highlighted as I
scroll?




L. Howard Kittle

Something like this will high light the row of any cell selected in the
range B8 to K22 from column B to K. You can change to meet your parameters.

Copy and paste into the sheet module. I don't remember if I wrote this or
picked it from the newsgroup, apologies to the author if not mine for not
crediting him/her.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = 2
j = 8
k = ActiveCell.Column()
Set Data = Range("B8:K22")

Data.Interior.ColorIndex = xlNone

If ActiveCell.Row < 8 Or ActiveCell.Row 22 Or _
ActiveCell.Column < 2 Or ActiveCell.Column 11 Then
Exit Sub
End If

ActiveCell.Offset(0, -(k - i)). _
Resize(1, 10).Interior.ColorIndex = 35

End Sub


And one from J. E. that does the whole row and preserves any other color
formatting on the sheet.

' J.E. McGimpsey 6/15/2001
Private Sub Worksheet_SelectionChange(ByVal 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.ColorIndex
Next i
ActiveCell.EntireRow.Interior.ColorIndex = 15
Set oldRange = ActiveCell.EntireRow
End Sub

HTH
Regards,
Howard

"blackrb1" wrote in message
...
As I scroll down the rows in Excel, the row number and the current cell
are
highlighted. Is there a way to have the entire row be highlighted as I
scroll?





All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com