Using an array with Conditional Formatting

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
721
Office Version
  1. 2016
Platform
  1. Windows
I found what I thought to be the answer on another forum - Conditional formating in VBA, same color, multiple strings?
Forgive me if I'm not supposed to post from other forums.

Below is my edit based on my needs, and when it is ran I received a run-time error 5 - Invalid procedure call or argument.
Everything looks similar to the users post, where have I gone wrong? Thank you

VBA Code:
Sub myloop2()
        myArray = Array("Complete", "Up to Date", "Yes")
        For y = LBound(myArray) To UBound(myArray)
            With Range(Cells(2, 13), Cells(2, 13).End(xlDown)).resize(, 7).FormatConditions.Add(Type:=xlCellString, String:=myArray(y), TextOperator:=xlEqual)
                .Interior.Color = RGB(0, 128, 0)
                .font.Color = RGB(255, 255, 255)
            End With
        Next
End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,170
Messages
6,123,422
Members
449,099
Latest member
COOT

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