Home » excel » excel – Copy conditional formatting from one cell to another using VBA?

excel – Copy conditional formatting from one cell to another using VBA?

Posted by: admin April 23, 2020 Leave a comment

Questions:

Can I copy conditional formatting from one cell to another using VBA?

I’m imagining something like:

Sheets("A").Range("A1:A10").ConditionalFormatting = Sheets("B").Range("B1").ConditionalFormatting
How to&Answers:

use this:

Sub test()
     Sheets("B").[B1].Copy: Sheets("A").[A1:A10].PasteSpecial xlPasteFormats
End Sub