change row colour when cell is selected for ease

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
743
Office Version
  1. 365
Platform
  1. Windows
Hello

I have a sheet but in struggling to see if I'm on the correct row when im filling it in
Can you change the row colour when a cell is selected?


ie: if I select any thing between G21:AE21 I can get A21:E21 to change colour
But if nothing is selected then don't change anything

Hope ive explained it easy enough

Jay
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Here are the steps to highlight the active row.

Select the data you want to highlight.

Go to the Home tab.
Click on Conditional Formatting and then click on New Rule.
In the New Formatting Rule dialog box, select “Use a formula to determine which cells to format”.
In the Rule Description field, enter the formula: =CELL(“row”)=ROW())
Click on the Format button and specify the formatting (the colour in which you want the row highlighted).
Click OK.
The above steps have taken care of highlighting the active row whenever there is a selection change event.

However, to make this work, you need to place a simple VBA code in the backend.


Here is the VBA code that you can copy and paste.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = False Then
Application.Calculate
End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,941
Members
452,539
Latest member
delvey

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