Highlight Active Row

baramburum

New Member
Joined
Dec 21, 2010
Messages
48
Hi Experts:

I need a simple function - Highlight the row that I am currently stay in

Something like that:
http://www.youtube.com/watch?v=bGjqDGF7xaM

I used to use this code:

---------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

ActiveSheet.Rows(Target.Row).Select ' highlite entire row
Target.Activate ' select the cell

End Sub
-----------------------

But it is not really comfortable, because now you have to double click on cell to copy or something else.

Please advice the better solution

thanks
 
The 'selectionchange' method might work thus:

Paste the code into the worksheet module, keeping the variable r dimmed outside the procedure. Note, this isn't much good if you have coloured cells in the sheet.

Code:
Dim r As Long
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If r <> 0 Then Rows(r).EntireRow.Interior.ColorIndex = xlNone
    r = Target.Row
    Rows(r).EntireRow.Interior.ColorIndex = 3 'change to suit
End Sub


hi. thanks. But i need the different function. Just simple hilight the row i am currently working on
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
That is pretty handy. Can you do the same thing with highlighting the column you are working in using conditional formatting?
 
Upvote 0
click the grey square to the left of a and above 1 to select the whole sheet.

On the home tab click conditional formatting, click new rule, click use a formula...

Enter the formula

=row()=cell("row")

then click the format button, on the fill tab, click a colour then ok your way out.


thank you, thank you
works fine
 
Upvote 0
Yes, use either

=COLUMN()=CELL("col")

or

=OR(ROW()=cell("row"),COLUMN()=CELL("col"))
 
Upvote 0
I should have searched.

This will do both at the same time.

=OR(CELL("row")=ROW(),CELL("col")=COLUMN())

Opps, Vog beat me to it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top