Trying to write a macro that deletes all but the first and last N conditional formats.
Excel 2007 has a bug that generates tons of spurious copies of the (desired, user-generated conditional formatting as you copy-paste ranges. I can delete all at once easily enough, but then I have to recreate each desired conditional format. Or I can manually delete the spurious ones through the Excel toolbar interface, but I have to choose and confirm each single deletion, and these can number in the hundreds, thanks to this bug.
So, here's my code:
1. You'd think that setting cond as type FormatCondition would make it a member of type FormatConditions, but then the line
produces a "Type mismatch" error. So, I changed it to Variant.
2. As type Variant, it produces an error on the line
"Application-defined or object-defined error".
3. So, I tried using a simple counter:
Same "Application-defined or object-defined error".
OK, there's obviously some bugs in MS Excel's application model (unless I'm missing an obvious mistake or three). Anyone know a workaround?
Bookmarks