Change a blank cell color based on another cell value

erutherford

Active Member
Joined
Dec 19, 2016
Messages
458
B2 has a drop down menu with two choices "50 or "55". If you select "50" I would like cell J6:J7 to turn red (no values in the cell, just a blank red cell. Every example I have seen requires a valve in my blank cell.
Thanks in advance
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Use Conditional formatting.
Select cells J6:J7 and in conditional formatting use a formula to create a formatting rule.

it can be =B2=50
or may be
=B2="50"
if you have really 50 as text (not as number) in this dropdown

1734456331972.png
 
Upvote 0
Solution
by vba in sheet module copy and paste
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" Then
If Target.Value = 50 Then
Range("J1:J7").SpecialCells(xlCellTypeBlanks).Interior.Color = vbRed
End If
End If
End Sub
just write 50 in B2
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,725
Members
453,368
Latest member
positivemind

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