Share via


Delete Method

Deletes the specified object.

expression**.Delete()**

*expression   * An expression that returns one of the objects listed above.

Remarks

If the Delete method is called on an XmlDataBinding or XmlMap object while an asynchronous binding is in progress, a run-time error will occur. You can determine if a data binding is asynchronous using the Async property of the XmlDataBinding object. You can determine whether a binding is in progress using the BindingInProgress property of the XmlDataBinding object.

Calling the Delete method on an XmlMap object without deleting the associated binding will generate a run-time error. To avoid this error, you must call the Delete method on the XmlDataBinding object that represents the associated binding first.

Delete method as it applies to the ChAxes, ChCharts, ChSeriesCollection, ElementExtensions, GroupingDefs, GroupLevels, LookupRelationships, PageFields, ParameterValues, RecordsetDefs, SchemaFields, SchemaRelationships, SchemaRowsources, and SublistRelationships objects.

Deletes a single object from the specified collection.

expression**.Delete(Index)**

*expression   * An expression that returns one of the objects listed above.

Index    Required Variant. Specifies the name or number of the object to be deleted.

Delete method as it applies to the ChDataLabelsCollection, ChErrorBarsCollection, ChSegments and ChTrendlines objects.

Deletes a single object from the specified collection.

expression**.Delete(Index)**

*expression   * An expression that returns one of the objects listed above.

Index    Required Long. Specifies the name or number of the object to be deleted.

Delete method as it applies to the Range object.

Deletes the specified cells from the worksheet.

expression**.Delete(Shift)**

*expression   * An expression that returns one of the objects listed above.

Shift    Optional Variant. 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.

Example

As it applies to the ChDataLabelsCollection collection.

This example deletes the data labels from the specified series in the chart workspace.

ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection.Delete 0

Applies to | ChAxes Collection | ChCharts Collection | ChDataLabelsCollection Collection | ChErrorBarsCollection Object | ChSegments Object | ChSeriesCollection Collection Object | ChTrendlines Collection | ElementExtensions Collection Object | GroupingDefs Collection Object | GroupLevels Collection Object | Hyperlink Object | ListRow Object | LookupRelationships Collection Object | Name Object | PageFields Collection Object | ParameterValues Collection Object | PivotHyperlink Object | Range Object | RecordsetDefs Collection Object | SchemaFields Collection Object | SchemaRelationships Collection Object | SchemaRowsources Collection Object | Sheets Collection | SublistRelationships Collection Object | Worksheet Object | Worksheets Collection Object | XmlDataBinding Object | XmlMap Object

See Also | Clear Method