Expand Minimize

NamedRange.Table Method

Creates a data table based on input values and formulas that you define in a worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Object Table(
	Object RowInput,
	Object ColumnInput


Type: System.Object
A single cell to use as the row input for your table.
Type: System.Object
A single cell to use as the column input for your table.

Return Value

Type: System.Object

Use data tables to perform a what-if analysis by changing certain constant values on your worksheet to see how values in other cells are affected.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example uses the Table method to create a formatted multiplication table in a NamedRange.

This example is for a document-level customization.

private void CreateTable()
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", "K11"],

    this.Range["A1", missing].Formula = "=A12*A13";
    for (int i = 2; i <= 11; i++)
        ((Excel.Range)this.Cells[i, 1]).Value2 = i - 1;
        ((Excel.Range)this.Cells[1, i]).Value2 = i - 1;

    namedRange1.Table(this.Range["A12", missing],
        this.Range["A13", missing]);
    Excel.Range region = this.Range["A1", missing].CurrentRegion;
    ((Excel.Range)region.Rows[1, missing]).Font.Bold = true;
    ((Excel.Range)region.Columns[1, missing]).Font.Bold = true;

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft