Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Copy a Row or Column

This example demonstrates how to copy a row or column in a worksheet.

To do this, access a destination row (Row) or column (Column) object and call its CellRange.CopyFrom method. Pass the source row or column object as a parameter. If you need to specify the type of data be copied (for example, values only, formats only, formulas only, borders only, etc.), pass the required member of the PasteSpecial enumerator as well.

View Example

// Copy all data from the 2nd row to the 5th row.
worksheet.Rows["5"].CopyFrom(worksheet.Rows["2"]);

// Copy only borders from the "B" column to the "E" column.
worksheet.Columns["E"].CopyFrom(worksheet.Columns["B"], PasteSpecial.Borders);
See Also