I want to copy background color for example sheetA cell A1 to sheet B A1.

The cell A1 is using conditional formatting, I can copy simple but not with conditional formatting enabled.

Here is the code

Dim varTemp As Variant

varTemp = Worksheets("Summary").Range("F15:F21").Formula
Worksheets("Summary").Range("F15:F21").PasteSpecial xlPasteAllMergingConditionalFormats
Worksheets("Summary").Range("F15:F21").Formula = varTemp

when I run the VB it just select the target cells and ask me to PASTE the results. So the bottom left status bar in video

  • Is the background color conditionally formatted? – wizlog Jun 27 '16 at 18:23

The code below works for me, it copies the cell (background) colors into other cells in a different sheet.

Sub copyFormat()
    Range("a1:b1").PasteSpecial (xlPasteFormats)
End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.