PDA

View Full Version : [SOLVED:] Adding VBA Conditional Formatting



oam
07-05-2022, 05:08 AM
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.

oam
07-08-2022, 11:57 AM
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 :think:

rollis13
07-08-2022, 02:56 PM
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.

oam
07-18-2022, 01:48 PM
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

rollis13
07-18-2022, 02:09 PM
Since you didn't report it in your profile what version were you using ?