Help with Cell Color Change Macro

Merlin610

New Member
Joined
Apr 30, 2013
Messages
2
I need help with a macro that changes the color of a cell column range depending on the words in a cell out of the range.

For example, if B12="JSP-MIC" the color of B13-B19 should be yellow,
If B12="JSP-AOUT" the color of the range should be green,
If B-12=". . ." the color of the range should be grey.

There are additional values for B12, but those are the only three colors.

I have started several times, but I am getting nowhere fast.

Thanks
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

ZAX

Well-known Member
Joined
Jul 5, 2012
Messages
715
I need help with a macro that changes the color of a cell column range depending on the words in a cell out of the range.

For example, if B12="JSP-MIC" the color of B13-B19 should be yellow,
If B12="JSP-AOUT" the color of the range should be green,
If B-12=". . ." the color of the range should be grey.

There are additional values for B12, but those are the only three colors.

I have started several times, but I am getting nowhere fast.

Thanks
Is this code helping you??
Code:
Sub ColorRange()
Select Case Range("B12").Value
Case "JSP-MIC"
Range("B13:B19").Interior.Color = vbYellow
Case "JSP-AOUT"
Range("B13:B19").Interior.Color = vbGreen
Case ". . ."
Range("B13:B19").Interior.Color = 46
End Select
End Sub
ZAX
 

Watch MrExcel Video

Forum statistics

Threads
1,122,334
Messages
5,595,567
Members
413,996
Latest member
mabelO

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
Top