Delete Method [Excel 2003 VBA Language Reference]
Deletes the object.
expression Required. An expression that returns a Range object.
Shift Optional Variant. Used only with Range objects. Specifies how to shift cells to replace deleted cells. Can be one of the following XlDeleteShiftDirection constants: xlShiftToLeft or xlShiftUp. If this argument is omitted, Microsoft Excel decides based on the shape of the range.
Deletes the column of data in the list. Does not remove the column from the sheet. If the list is linked to a Microsoft Windows SharePoint Services site, the column cannot be removed from the server, and an error is generated.
expression Required. An expression that returns a ListColumn object.
Deletes the ListObject object and clears the cell data from the worksheet. If the list is linked to a SharePoint site, deleting it does not affect data on the server that is running Windows SharePoint Services. Any uncommitted changes made to the local list are not sent to the SharePoint list. (There is no warning that these uncommitted changes are lost.)
expression Required. An expression that returns a ListObject object.
Deletes the cells of the list row and shifts upward any remaining cells below the deleted row. You can delete rows in the list even when the list is linked to a SharePoint site. The list on the SharePoint site will not be updated, however, until you synchronize your changes.
expression Required. An expression that returns a ListRow object.
Deletes the object.
expression Required. An expression that returns a ShapeNode object.
Index Required Integer.
Removes the specified XML map from the workbook.
expression Required. An expression that returns an XmlMap object.
Deletes the object.
expression Required. An expression that returns one of the objects in the Applies To list.
Deleting the XML map will convert all of the XML Lists to generic Lists and remove all of the single-cell mappings (with the data still remaining). In addition, the XmlMap object will be removed from the XmlMaps collection. The map and schema information will be removed from the workbook (it will no longer be persisted in the XLS file and XMLSS). Any references to the deleted object become invalid.
When you delete a Workbook or Worksheet, this method displays a dialog box that prompts the user to confirm the deletion. This dialog box is displayed by default. When called on the Workbook or Worksheet objects, the Delete method returns a Boolean value that is False if the user clicked Cancel on the dialog box or True if the user clicked Delete.
Deleting a Point or LegendKey object deletes the entire series.
You can delete custom document properties, but you cannot delete a built-in document property.
You can delete cube fields only if you have created the cube fields yourself by using the CalculatedMember.Add method with the xlCalculatedSet argument.
This example deletes cells A1:D10 on Sheet1 and shifts the remaining cells to the left.
This example deletes Sheet3 in the active workbook without displaying the confirmation dialog box.
Application.DisplayAlerts = False Worksheets("Sheet3").Delete Application.DisplayAlerts = True
This example sorts the data in a column of the worksheet specified and then deletes rows that contain duplicate data.
Sub DeleteColumnDupes(strSheetName As String, strColumnLetter As String) Dim strColumnRange As String Dim rngCurrentCell As Range Dim rngNextCell As Range strColumnRange = strColumnLetter & "1" Worksheets(strSheetName).Range(strColumnRange).Sort _ Key1:=Worksheets(strSheetName).Range(strColumnRange) Set rngCurrentCell = Worksheets(strSheetName).Range(strColumnRange) Do While Not IsEmpty(rngCurrentCell) Set rngNextCell = rngCurrentCell.Offset(1, 0) If rngNextCell.Value = rngCurrentCell.Value Then rngCurrentCell.EntireRow.Delete End If Set rngCurrentCell = rngNextCell Loop End Sub