Highlight cell in same row but columns away

November 13, 2010 at 16:32:31
Specs: Windows 7
Someone has posted this question a while back and DerbyDad03 answered it, but not it is not exactly what I am looking for. I need to highlight (with interior.color) a cell in the same row as my active cell, but in a specific column.
I have a grade book in excel. I have all of the grades for different activities in a row. The activities are labeled in the column header. Let's say John is in Row 2 - I want to highlight his name when I am working on his row no matter what cell I am in.

DerbyDad03 posted this code:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
On Error Resume Next
'Get address to reset highlighting
oldTarget = Range("A1")
'Reset highlighting
Range(oldTarget).Interior.ColorIndex = xlNone
'Highlight cell 7 columns to the right
target.Offset(0, 7).Interior.ColorIndex = 6
'Store highlighted cell address for use next time
Range("A1") = target.Offset(0, 7).Address
End Sub

And it works perfectly, except I need it to start when the workbook opens, and I need it to select the same column no matter what column is active. His just goes 7 columns to the right and not the same column.



See More: Highlight cell in same row but columns away

November 13, 2010 at 16:33:29
To be more precise - john's name is in cell M2

Report •
Related Solutions

Ask Question