We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

PasteSpecial Paste:=xlPasteFormats

Is there any fast way in XLSIO to copy the formats of all cells in a row to another row?

Compare to this Excel macro:
Rows("9:9").Select
Selection.Copy
Rows("10:10").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

3 Replies

MW Melba Winshia Syncfusion Team December 21, 2006 10:50 AM UTC

Hi Janne,

Use the following code snippets to copy the styles and formats of all cells in a row to another row.

[C#]

//Copying the range with styles.
sheet1.Range["A1"].EntireRow.CopyTo(sheet1.Range["C3"].EntireRow,ExcelCopyRangeOptions.CopyStyles);

Here is the sample for your reference:

Copying.zip


Please take a look at the sample above and let me know if you have any other questions.

Best Regards,
Melba



JC Jan-Erik Carlson December 21, 2006 06:10 PM UTC

Hi Melba,

Nice solution. Thanks for your answer.

I assume that your code snippet copy values, styles and formats.
How do I do if I don't want to copy the values, just the styles and formats? "(ExcelCopyRangeOptions.CopyStylesOnly)"

In Excel Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
copyies styles and formats including conditional formatting (Selection.FormatConditions). Is "FormatConditions" included when ExcelCopyRangeOptions.CopyStyles is specified?

Best Regards,
Janne


MW Melba Winshia Syncfusion Team December 22, 2006 12:15 PM UTC

Hi Janne,

Currently we do not provide support to copy the styles and formats alone. So I have created a feature request with the development team. You can track the status here.

http://www.syncfusion.com/support/features/xlsio/Default.aspx?ToDo=view&questId=1425

I will update you as soon as an estimate is available. Sorry for the inconvenience. Please let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon