add color to drop-down list

skunkworks

New Member
Joined
Jan 21, 2022
Messages
21
Office Version
  1. 2016
Platform
  1. Windows
Column J, which holds items to be included in a drop-down list, is typically hidden. When I select an item in the list in column C, I'd like it to turn green (or pink or whatever color I fancy that day), as shown in Column J. How can this be done?



Screen Shot 02-28-24 at 07.24 AM.PNG
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in column C.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("C:C")) Is Nothing Then Exit Sub
    Target.Interior.ColorIndex = Range("J2").Interior.ColorIndex
End Sub
 
Upvote 0
Solution
Thanks, mumps! A new cell in column C is now gray. How can I change it to another color?

Also, using the code you supplied necessitated saving the file as macro-enabled. Is that correct?
 
Upvote 0
Also, using the code you supplied necessitated saving the file as macro-enabled. Is that correct?
That is correct.
A new cell in column C is now gray. How can I change it to another color?
I'm not sure what you mean. Please clarify in detail referring to specific cells, rows and columns using a few examples from your data.
 
Upvote 0
Please see attached image showing new gray cells in column C. I'd like to have the ability to change the color of all cells in column C to another color for each new production. In this case, I'd like them to be close to the green shown in column J.
 

Attachments

  • Screen Shot 02-28-24 at 10.13 AM.PNG
    Screen Shot 02-28-24 at 10.13 AM.PNG
    31.4 KB · Views: 3
Upvote 0
You would have to click on each grey cell and re-select the value in the drop down list. Whenever you select a value from the drop down, the color will change to that in cell J2.
 
Upvote 0
It's not that important. :) The original version of this file, received from someone else, had all cells in column C green. 'Tis a mystery.

Thanks again for your help. It's much appreciated!
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

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