locked
Copy All Range Formatting and Values (C#) RRS feed

  • Question

  • How do you move a range's color, borders, values, etc. from one worksheet to another?

    For example if I'm trying to take cells A1:F20 from a source worksheet and apply them to another.  I need the values but also any formatting those cells have to copy to the other worksheet.

    Thanks for any help.  I'm sure there is a quick solution that I am overlooking.



    Thursday, October 6, 2011 8:00 PM

Answers

  • Excel.Range sourceHeader_Range = ...insert range here...;

    Excel.Range targetHeader_Range = ...insert range here...;

    sourceHeader_Range.Copy(targetHeader_Range);

     

    Thanks!  Above is the code I used to accomplish the task I needed.

    Thursday, October 6, 2011 9:30 PM

All replies

  • Excel.Range sourceHeader_Range = ...insert range here...;

    Excel.Range targetHeader_Range = ...insert range here...;

    sourceHeader_Range.Copy(targetHeader_Range);

     

    Thanks!  Above is the code I used to accomplish the task I needed.

    Thursday, October 6, 2011 9:30 PM
  • Hi John,

    Glad to see this issue has been resolved and thanks for your sharing.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 26, 2011 8:56 AM