跳到主要内容

Format range as table

Formats the range of cells A1:D10 as a table.

(function()
{
Api.GetActiveSheet().FormatAsTable("A1:D10");
})();

Methods used: GetActiveSheet, FormatAsTable

Reference Microsoft VBA macro code

Sub example()
Sheet1.ListObjects.Add(xlSrcRange, Range("A1:D10"), , xlYes).Name = "myTable1"
End Sub

Result

Range as a tableRange as a table