I am struggling with something that seems fairly simple. I am trying to copy just the conditional formatting rules of a cell to another. I have searched for similar questions here:
1) Copy Format Conditions from one cell to another?
and elsewhere:
2) https://www.mrexcel.com/forum/excel-questions/369089-vba-copy-conditional-formatting.html
...but most answers tend to just say to use .PasteSpecial xlPasteFormats
, which 9 times out of 10 does the job, but is not a true answer to what I am trying to do (see the comment from a user on the SO question: "This also copies more than just the conditional formatting but I can deal with it").
I am trying to take the conditional formatting rules from one cell and apply them to another cell that is formatted differently as standard. Judging by this set of examples of .PasteSpecial
enums there isn't one that does the exact job - xlPasteAllMergingConditionalFormats
looks like it comes close but I don't actually want to paste anything from one cell to another.
Tried a few hopeless guesses like:
For Each cond In rng1.FormatConditions
rng2.FormatConditions.Add (cond)
Next cond
But I know it needs more than that... Any help appreciated!