Copy background color from one cell to cell in separate sheet using ms-excel?

  • 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





    Code
    Dim strTemp As String
    
    
    
    
    strTemp = Worksheets("sheetB").Range("A1").Formula
    Worksheets("sheetA").Range("A1").Copy
    Worksheets("sheetB").Range("A1").PasteSpecial xlPasteAllMergingConditionalFormats
    Worksheets("sheetB").Range("A1").Formula = strTemp


    The issue , is that my target cells are not populated correctly, see gif animation Link here



    https://giphy.com/gifs/l41YBpcLxaGLQYqn6

  • Re: Copy background color from one cell to cell in separate sheet using ms-excel?


    Please use Code tags in future.


    Also instead of spending time uploading a video attach an example workbook


    Try this



    Code
    '
        Worksheets("sheetA").Range("A1").Copy
        Worksheets("sheetB").Range("A1").PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
        Worksheets("sheetB").Range("A1").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
  • Re: Copy background color from one cell to cell in separate sheet using ms-excel?




    Nice idea please see attachment; there is error in running the code.forum.ozgrid.com/index.php?attachment/69520/

  • Re: Copy background color from one cell to cell in separate sheet using ms-excel?


    The workbook that you have attached does not contain any code so how can I check it.


    Also, please don't quote previous posts, use the new reply button

  • Re: Copy background color from one cell to cell in separate sheet using ms-excel?


    The cell A1 doesn't contain any conditional formatting neither on Summary Sheet nor on People Sheet in the sample workbook.


    Also the range F15:F21 on Summary Sheet is already having conditional formatting rule and if you delete the existing rules from the Summary Sheet, the following code will copy the conditional formatting rules from the range G3:G9 on People Sheet into the Summary Sheet.


    Code
    Worksheets("People").Range("G3:G9").Copy
    Worksheets("Summary").Range("F15").PasteSpecial xlPasteAllMergingConditionalFormats


    What are you trying to achieve here?
    Please upload the correct workbook with the correct code you are having trouble with.

    Regards.
    sktneer

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!