Resize ListObject controls
You set the size of a ListObject control when you add it to a Microsoft Office Excel workbook; however, you might want to resize it at a later time. For example, you might want to change a two-column list to three columns.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Excel. For more information, see Features available by Office application and project type.
You can resize ListObject controls at design time or at run time in document-level projects. You can resize ListObject controls at run time in a VSTO Add-in project.
This topic describes the following tasks:
Resize ListObject controls at run time in a document-level project
Resize ListObject controls at run time in a VSTO Add-in project
For more information about ListObject controls, see ListObject control.
Resize a ListObject control at design time
To resize a list, you can click and drag one of the sizing handles, or you can redefine its size in the Resize List dialog box.
To resize a list by using the Resize List dialog box
Click anywhere in the ListObject table. The Table Tools > Design tab in the ribbon appears.
In the Properties section, click on Resize Table.
Select the new data range for your table.
Click OK.
Resize a ListObject control at run time in a document-level project
You can resize a ListObject control at run time by using the Resize method. You cannot use this method to move the ListObject control to a new location on the worksheet. The headers must remain in the same row, and the resized ListObject control must overlap the original list object. The resized ListObject control must contain a header row, and at least one row of data.
To resize a list object programmatically
Create a ListObject control that spans cell A1 through B3 on
Sheet1
.Resize the list to include cells A1 through C5.
Resize a ListObject at run time in a VSTO Add-in project
You can resize a ListObject control on any open worksheet at run time. For more information about how to add a ListObject control to a worksheet by using a VSTO Add-in, see How to: Add ListObject controls to worksheets.
To resize a list object programmatically
Create a ListObject control that spans cell A1 through B3 on
Sheet1
.Resize the list to include cells A1 through C5.
Related content
- Extend Word documents and Excel workbooks in VSTO Add-ins at run time
- Controls on Office documents
- Add controls to Office documents at run time
- Host items and host controls overview
- Automate Excel by using extended objects
- ListObject control
- How to: Add ListObject controls to worksheets
- How to: Resize NamedRange controls