Cell Colors as the cursor moves

rrowe

New Member
Joined
Feb 23, 2004
Messages
21
Is there a way to highlight ( in a color ) the cells as you move the cursor around in Excel? For instance, if you are in one cell, it would be in a color that you pick. When you move the cursor up, down, left, or right, the cell that you go to would then turn that color
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try the following code :

Sub Worksheet_SelectionChange(ByVal target As Range)
If Intersect(Range("A1:Z20"), Range(target(1).Address)) _
Is Nothing Then Exit Sub
Cells.Interior.ColorIndex = xlNone
ActiveCell.Interior.Color = vbCyan
End Sub
 
Upvote 0
Thanks for the quick reply. I don't know how to enter the code. Can you walk me thru, thanks!
 
Upvote 0
don't know how to enter the code. Can you walk me thru, thanks!
1. Right click the sheet name tab and choose "View Code".
2. Paste the code in the main right hand pane of the Visual Basic window that opens in step 1.
3. Close the VB window.

Notes:
1. The code is just to colour the cell if it is in the range A1:Z20, though you can change that if you want.
2. Be aware that if you have any cells in your worksheet coloured manually, that colour will be deleted by this code.
 
Upvote 0
Thanks Verluc. It's great to have folks like you to be on standby for us rookies. Have a great day!!
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

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