View Full Version : Highlight whole row as cursor moves


bulrush
09-17-2009, 05:13 AM
Excel 2000 on Windows

I have a very wide spreadsheet, as such, I have to shrink it down to see more columns in the window. As my cursor moves around in the spreadsheet the row and column labels are bold. My old eyes would like the whole row to be highlighted with a certain color as the cursor moves because I have to check data in many columns in each row.

Is this possible? I didn't see anything like this in the Options window.

Thanks.

p.s. This is not a static highlight where I highlight the row, and click the Background Color button. This is a dynamic highlight to moves with my cursor.

Is there any way to enter the code once and have it work on any worksheet tab in the worksheet file?

chergh
09-17-2009, 07:27 AM
AFAIK you can't do this as there is no mouse over event to trigger the row highlighting.

HaHoBe
09-17-2009, 08:53 AM
Hi, bulrush,

please mind that code will clear all other colors, goes behind the worksheet:

Public mlngOldRow As Long

Private Sub Worksheet_Activate()
mlngOldRow = ActiveCell.Row
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If mlngOldRow > 0 Then Rows(mlngOldRow).Interior.ColorIndex = xlNone
With Target
If .Row <> mlngOldRow Then
.EntireRow.Interior.ColorIndex = 6
mlngOldRow = .Row
End If
End With
End Sub
Highlight is what I expect to be highlighing color number 1 (yellow).

Ciao,
Holger

bulrush
09-17-2009, 11:08 AM
Thank you.

bulrush
02-17-2010, 10:54 AM
I used to have this code (I think) in my Personal.xls workbook, which means it affected all open spreadsheets. The code doesn't seem to work at all, when I pasted it into my Personal.xls workbook, which is opened every time I restart Excel.

I even tried restarting Excel. Got any clue how to make this work for all worksheets open?

HaHoBe
02-17-2010, 12:09 PM
Hi, bulrush,

I pretty much doubt that the code ever worked from the personal.xls for open workbooks due to the fact that the Worksheet-Events only works for the given sheets in the workbook where the code is located.

You can work around that by using Class programming and thus activating the code for any open workbooks and worksheets. Please have a look at Introduction To Classes (http://www.cpearson.com/excel/Classes.aspx) by Chip Pearson or Control Events (http://www.jkp-ads.com/articles/ControlHandler00.asp) by Jan Karel Pieterse or rely on MSDN with Custom Classes and Objects (http://msdn.microsoft.com/en-us/library/aa140954%28office.10%29.aspx) (for Office XP).

HTH,
Holger

qafself
02-18-2010, 01:55 AM
You could use conditional formatting to colour alternate rows - make reading across much easier