Deletes the object.
expression.Delete(Shift)
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.
Delete method as it applies to the ListColumn object.
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.Delete()
expression Required. An expression that returns a ListColumn object.
Delete method as it applies to the ListObject 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.Delete()
expression Required. An expression that returns a ListObject object.
Delete method as it applies to the ListRow 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.Delete()
expression Required. An expression that returns a ListRow object.
Delete method as it applies to the ShapeNodes object.
Deletes the object.
expression.Delete(Index)
expression Required. An expression that returns a ShapeNode object.
Index Required Integer.
Delete method as it applies to the XmlMap object.
Removes the specified XML map from the workbook.
expression.Delete()
expression Required. An expression that returns an XmlMap object.
Delete method as it applies to all other objects in the Applies To list.
Deletes the object.
expression.Delete()
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
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.
Example
This example deletes cells A1:D10 on Sheet1 and shifts the remaining cells to the left.
Worksheets("Sheet1").Range("A1:D10").Delete Shift:=xlShiftToLeft
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