How to: Copy Data and Formatting across Worksheets

Switch View :
ScriptFree
Visual Studio 2010
How to: Copy Data and Formatting across Worksheets

You can copy data from a range on one sheet to all the other sheets in a workbook by using the FillAcrossSheets method. Specify a range, and whether you want to copy data, formatting, or both.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Example

Visual Basic

Me.Application.ActiveWorkbook.Sheets.FillAcrossSheets( _
    Me.Application.Range("rangeData"), Excel.XlFillWith.xlFillWithAll)


C#

this.Application.ActiveWorkbook.Sheets.FillAcrossSheets(
    this.Application.get_Range("rangeData", missing), 
    Excel.XlFillWith.xlFillWithAll);


Compiling the Code

This example requires a range named rangeData in a worksheet.

See Also

Tasks

Concepts