Delete Method

Microsoft Graph Visual Basic

Show All

Delete Method

       

Delete method as it applies to all objects in the Applies To list except the Range object.

Deletes the specified object.

expression.Delete

expression   Required. An expression that returns one of the above objects.

Delete method as it applies to the Range object.

Deletes the specified object.

expression.Delete(Shift)

expression   Required. An expression that returns one of the above objects.

Shift   Optional XlDeleteShiftDirection. Used only with Range objects. Specifies how to shift cells to replace deleted cells.

XlDeleteShiftDirection can be one of these XlDeleteShiftDirection constants.
xlShiftToLeft
xlShiftUp

If this argument is omitted, Microsoft Graph decides how to shift cells based on the shape of the specified range.

Remarks

Deleting a Point or LegendKey object deletes the entire series.

Example

This example deletes cells A1:D10 on the datasheet and shifts the remaining cells to the left.

Set mySheet = myChart.Application.DataSheet
mySheet.Range("A1:D10").Delete Shift:=xlShiftToLeft

This example deletes the chart title.

myChart.ChartTitle.Delete