Highlight Selected Active Cell

L

Legacy 440179

Guest
I am using Windows 10, Microsoft Office 365 (2016). I have written macros in older versions of Excel and had no trouble, but now I am stumped!

I need help creating a macro that will change the active cell in Excel to a different color - RGB (R204,G102,B255) which is in the purple color range. I do not need the border color around it - only the highlighted cell color. I also want the purple to go back it it's original color when I switch into another cell. If the cell would have a color in it, such as yellow, I would like that color to go back to the yellow, to make it easier to locate the cell easier; otherwise, it goes back to white.

I also want to save the macro in a folder I have set up - C:\Users\arsgs\AppData\Roaming\Microsoft\Excel\XLSTART
Read I needed to do this in order for the macro(s) to work in any workbook I have open.
Do I enter the codes to set up macro(s) in a blank Excel worksheet and save it in the above folder? Can I name it Macros and then have different macros on different sheets with the description of what it does as the name?

Lastly, once I open a worksheet in one of my workbooks, how do I make the appropriate macro run? This is very different from my 2003 version, and I am now retired for 6 1/2 years, so it's re-learning everything from scratch. Just because I am older, I still want to be able to create and use these the helpful tools as I call them. SORRY FOR THE LONG EMAIL. I hope someone is willing to help me. Thanks.
 

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 this, in the Sheet Module
Change your colour number and required range to suit
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iColor As Integer
If Intersect(Target, Range("A6:A500")) Is Nothing Then Exit Sub
Range("A6:A500").Interior.ColorIndex = 2
iColor = Target.Interior.ColorIndex
If iColor = 2 Then iColor = 39
Target.Interior.ColorIndex = iColor
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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