Change Cell Colors with each change of a drop down list value

Wolfster63

New Member
Joined
May 2, 2018
Messages
24
I am trying to modify a status board for our hospital operating room that will enable whoever is updating the board to change the color of cells according to a value selected from a drop down box.

Unfortunately, I can't use conditional formatting hence the VBA route. I have be experimenting with some code as follows:

Sub ColorMeElmo()
Dim i As Long, r1 As Range, r2 As Range
For i = 2 To 15
Set r1 = Range("D" & i)
Set r2 = Range("A" & i & ":C" & i)
If r1.Value = "Turn Over" Then r2.Interior.Color = RGB(255, 0, 51)
If r1.Value = "Closing" Then r2.Interior.Color = RGB(255, 153, 0)
If r1.Value = "In OR" Then r2.Interior.Color = RGB(255, 255, 0)
If r1.Value = "Ready" Then r2.Interior.Color = RGB(255, 255, 255)
If r1.Value = "Done" Then r2.Interior.Color = RGB(255, 255, 255)
If r1.Value = "Done" Then r2.Font.Color = RGB(255, 255, 255)
Next i
End Sub


I need the code to execute each time a different value is selected from the drop down list. Right now, it only executes when the sheet is loaded.

I am not that proficient with VBA. I am hoping this could be a really simple fix.

Thanks in advance,

Will
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Glad we were able to help you.
And glad to see you know how to modify script to meet your needs

Come back here to Mr. Excel next time you need additional assistance.
 
Upvote 0

Forum statistics

Threads
1,216,743
Messages
6,132,464
Members
449,729
Latest member
davelevnt

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