Consulting

Results 1 to 5 of 5

Thread: Adding VBA Conditional Formatting

  1. #1
    VBAX Contributor
    Joined
    Oct 2013
    Posts
    181
    Location

    Adding VBA Conditional Formatting

    I had a VBA code that deleted and added conditional formatting rules back to a workbook (attached) that use to work but something happened and now I get an error when the code runs, maybe my excel program is to old.

    Is the code I have correct or can you provide help correcting the code so I can update the conditional formatting formulas?


    Also, is there a vba code that would allow me to arrange conditional formatting rules in the order I need them in? I have a template worksheet that I copy formats from to another worksheet and after I copy the formats the order of the conditional formatting rules are not in the order I need them to work properly.

    Thank you for any and all help with this.
    Attached Files Attached Files

  2. #2
    VBAX Contributor
    Joined
    Oct 2013
    Posts
    181
    Location
    Anyone! I know there are some very smart people on this forum.

    If the code is incorrect or if you have a code that would do the same thing please let me know.

    Thank you

  3. #3
    VBAX Contributor rollis13's Avatar
    Joined
    Jun 2013
    Location
    Cordenons
    Posts
    146
    Location
    Tested your macro and it gave an error here:
    With .FormatConditions.Add(Type:=xlExpression, Formula1:="=(MOD(ROW(E5),2)*(E5-E4<>1)=1)")
    Translated the formula into my language and now the macro works smoothly. Since your formula looks fine, I'll leave it to you to find the trick, I can't see it.

  4. #4
    VBAX Contributor
    Joined
    Oct 2013
    Posts
    181
    Location
    I determined the formula works but just not on the Excel version I have, once I run the code on a newer version of Excel it ran correctly.

    Thank you for help provided

  5. #5
    VBAX Contributor rollis13's Avatar
    Joined
    Jun 2013
    Location
    Cordenons
    Posts
    146
    Location
    Since you didn't report it in your profile what version were you using ?

Posting Permissions

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