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
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Select the whole sheet and apply the Conditional Formatting formula

=ROW()=CELL("row")

and apply a fill colour. Then right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

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

End Sub

Try:

ActiveSheet.Rows(Target.Row).EntireRow.Interior.ColorIndex = 3
'You can change the number there to get different colors
Target.Activate

Good luck!
 
Upvote 0
Try:

ActiveSheet.Rows(Target.Row).EntireRow.Interior.ColorIndex = 3
'You can change the number there to get different colors
Target.Activate

Good luck!

nice, but it highlights all row i have ever seen. I need only the current one. You know, just to make it comfortable to work
 
Upvote 0
Select the whole sheet and apply the Conditional Formatting formula

=ROW()=CELL("row")

and apply a fill colour. Then right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = True
End Sub

Hi, how i can "apply the Conditional Formatting formula" ?
 
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

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