Not quite what I was looking for.....

  • Thread starter Thread starter Ultimate
  • Start date Start date
U

Ultimate

When I pick a cell, I would like the whole row that the cell is in to
highlight. That is only as long as I have the cell picked. When I pick
another cell, I want that row to highlight. The highlight is only to
last as long as the cell in that row has been picked. Thanks in advance
for the help.
 
Ultimate

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static OldCell As Range
If Not OldCell Is Nothing Then
With OldCell
.EntireRow.Interior.ColorIndex = xlColorIndexNone
End With
End If
Target.EntireRow.Interior.ColorIndex = 6 'yellow'
Set OldCell = Target
End Sub

Gord Dibben Excel MVP
 
Hi

after re-reading your post maybe the following code is what you want
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
Target.EntireRow.Select

CleanUp:
Application.EnableEvents = True
End Sub

Frank
 
I have seen some of these scripts and such but I don't know how to put
it in a module and have the module run when I open the workbook.
 
Ultimate

To use Frank's or my code, right-click on a sheet tab and select "View Code".

Copy/Paste the code into the module that opens.

This code will run only on that worksheet.

To use Chip's Rowliner add-in, unzip the file and stick the Rowliner.xla into
your Office\Library.

Load it through Tools>Add-ins. Checkmark at Rowliner.

Rowliner will work on all open worksheets.

Gord Dibben Excel MVP
 
I figured out how to change the colour using your code, Gord. thanks
again, I'll be back with more questions as I see other things I want in
the sheet where I record the cases I handle on a daily basis.
 
Just change the number value in the line:

Target.EntireRow.Interior.ColorIndex = 6 'yellow'

The 'yellow' is commented and is not part of the code.
It's just there to let you know that 6 = yellow.

Biff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top