QueryTable.RefreshStyle (Excel)

Returns or sets the way rows on the specified worksheet are added or deleted to accommodate the number of rows in a recordset returned by a query. Possible return values are xlInsertDeleteCells - Partial rows are inserted or deleted to match the exact number of rows required for the new recordset, xlInsertEntireRows - Entire rows are inserted, if necessary, to accommodate any overflow. No cells or rows are deleted from the worksheet, xlOverwriteCells - No new cells or rows are added to the worksheet. Data in surrounding cells is overwritten to accommodate any overflow.

If you import data by using the user interface, data from a web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object. If you import data by using the object model, data from a web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable. You can use the QueryTable property of the ListObject to access the RefreshStyle property.


ActiveCell.QueryTable.RefreshStyle = xlInsertDeleteCells