More than 3 conditional formats

DavidC

New Member
Joined
Mar 17, 2002
Messages
26
I need more than 3 conditional formats, but cannot seem to get past the usual 3. I wrote a simple marco with 3 of them, as such:

Selection.FormatConditions.Delete

Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""Completed"""
Selection.FormatConditions(1).Interior.ColorIndex = 42

Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""Approved"""
Selection.FormatConditions(2).Interior.ColorIndex = 43

Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""Pending Approval"""
Selection.FormatConditions(3).Interior.ColorIndex = 45

then I tried to add additional ones. But it always gives me an error message "Run-time error '1004':", and has the fourth format line in yellow. How do I get past the 3 formats? Thanks.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi

this is well documented on this site and worth a seaqrch to see what suites you, check my post i posted a rear VBA script to do this so you can just add in as many conditions as you like,, i run 25 or so easy,,,,

If your stuck, please email me on my profile asking for the code and ill email to you and PLEASE in return update this feed do everone ca see it AND USE THE CODE,

A big thanks..
 
Upvote 0
If I understand your earlier posts, the code is not in a regular macro module, but in the sheet's code. However, my data is being exported into a new workbook from another application, and it is launching an Excel macro that will live in either my Personal.xls workbook or another workbook I would have open. So it doesn't look like it would work in my situation. Or would it?
 
Upvote 0
HI --

You original post askes only to get arround the 3 max con formats, this i have given you and will ork, your question of in a sheet or module matter little for this as its not private, my way of programmin g i have all sheet1 code in sheet1 and sheet2 in 2 etc.. can be module up to you make little difference.

OK I did not know you full situation but i guess you haveth erest of the code so this can be added and copy selection and paste to the new sheet, dont see a problem should slip in..

If problems can i suggest post FULL code and will add in for you...

trust thats some hel...
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

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