![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 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. |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
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..
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
__________________
Kind regards, Al Chara |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
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?
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
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...
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|