Rows Collection Methods: Remove 

Purpose

Removes an object from the Rows collection

Syntax

The Remove method has the syntax:

Remove(Variant vaIndex)

Returns

type Object

Description

Removes an object from the Rows collection. Legal types for the parameter vaIndex are:

Type

Description

Any variant data type convertible to an integer value.

The parameter vaIndex is converted to an integer and used as index in the collection. The corresponding object is removed from the collection and marked as invalid. Any further attempt to work on this object leads to an ‘Invalid object’ exception.

Object

The parameter vaIndex is used to search and remove the objects which are the same as vaIndex.

If vaIndex is of type Object, the entire collection is searched for the object. This may be very ineffective for large tables. Since a Rows collection may hold the same object only once, it is better to remove a row by its index or to invoke the remove method on the row object.

‘ do not use this construction :

Rows.Remove(Row)

‘ remove by Row index :

Rows.Remove(Row.Index)

‘ remove by row remove method :

Row.Remove