AddCustomList Method

Applies To

Application Object.

Description

Adds a custom list for custom autofill and/or custom sort.

Syntax

object.AddCustomList(listArray, byRow)

object

Required. The Application object.

listArray

Required. An array of strings, or a Range.

byRow

Optional. Only used if listArray is a Range. If True, Microsoft Excel creates a custom list from each row in the range. If False, Microsoft Excel creates a custom list from each column in the range. If this argument is omitted and there are more rows than columns (or an equal number of rows and columns) in the range, then Microsoft Excel creates a custom list from each column in the range. If this argument is omitted and there are more columns than rows in the range, then Microsoft Excel creates a custom list from each row in the range.

Remarks

If the list you are trying to add already exists, this method does nothing.

See Also

CustomListCount Property, DeleteCustomList Method, GetCustomListContents Method, GetCustomListNum Method.

Example

This example adds an array of strings as a custom list.


Application.AddCustomList Array("cogs", "sprockets", _
    "widgets", "gizmos")