A tough formatting quiz !

gaftalik

Well-known Member
Joined
Feb 6, 2003
Messages
521
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone, (y)

In the following table i need to set conditional formatting in C9:
if cell value = D5 (color in red)
if cell value = E5 ( color in blue)
if cell value = F5 (color in yellow)
if cell value = G5 (color in orange)
if cell value = H5 (color in teal)

which means more than 3 criteria.

I tried all the answers given in this thread and others and couldnt solve , is it possible ???

Thank you !
multiple criteria conditional formatting.xls
BCDEFGHI
1
2
3RANK12345
475431
5TYPEEBCAD
6
7
8TYPE
9A3
10B5
11C4
12D1
13E7
14
15
Sheet1
 
gaftalik said:
Thanks this worked too, what if i have under c13 many filled cells for which i have to format all of them to this condition
HI,

You would have to change the line
If Target.Address(False, False) <> "C9" Then Exit Sub

to not exit as appropriate.

What cells do you want this event to operate on?

Alan
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I want to apply on range C9:C100 and other similar ranges such as F9:F100 , H9:H50 , the problem is that i have no ideas about vba
 
Upvote 0
Hi,

Try

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range
Set R = Range("C9:C100,F9:F100,H9:H50")
If Union(Target, R).Address <> R.Address Then Exit Sub

Select Case Target.Value
Case Is = [D5]
    Target.Interior.ColorIndex = 3
Case Is = [E5]
    Target.Interior.ColorIndex = 32
Case Is = [F5]
    Target.Interior.ColorIndex = 27
Case Is = [G5]
    Target.Interior.ColorIndex = 46
Case Is = [H5]
    Target.Interior.ColorIndex = 28
Case Else
    Target.Interior.ColorIndex = xlNone
End Select

End Sub

HTH

Alan
 
Upvote 0
First i want to thank you very much for your concern, i had an error saying compile error Ambiguous name detected:worksheet_change when i applied that code
 
Upvote 0
:LOL: yeah indeed i did that and i deleted it , it worked, can i turn it to macro ?
 
Upvote 0
Hi,

Maybe you can use BrianB's solution, but change the line
Set MYRange = ....
to
Set MyRange = Range("C9:C100,F9:F100,H9:H50")

HTH

Alan
 
Upvote 0
Hi,

Maybe you can use BrianB's solution, but change the line
Set MYRange = ....
to
Set MyRange = Range("C9:C100,F9:F100,H9:H50")

HTH

Alan
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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