Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: More than 3 conditional formats

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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"

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •