Highlight a single cell on tab

hsl9999

New Member
Joined
Mar 18, 2018
Messages
10
I have a detailed spreadsheet with many rows and columns. Most cells are protected. Only 10 are nonprotected. To go from one non-protected cell to another I click the tab button. However I cannot see a change in the cell where the cursor lands. I would like to have the single cell where the cursor lands be highlighted with a bright yellow background so that the user does not have to struggle to see what field it is in. I have seen many examples that highlight a column or row whenever the cell is clicked on but not when it is sent there by a tab from a previous non-protected cell.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Assuming cells A1, C1, A3, C3, A5, C5, A7, C7, A9, and C9 are the ten unprotected cells, try placing the following sub in the sheet's code section (not in a module). Note: your sheet's protection should allow cell formatting.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Range("A1,C1,A3,C3,A5,C5,A7,C7,A9,C9").Interior.ColorIndex = 0
    Target.Interior.Color = vbYellow
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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