Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 1.55 KB

Excel.ControlFormat.RemoveItem.md

File metadata and controls

52 lines (31 loc) · 1.55 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ControlFormat.RemoveItem method (Excel)
vbaxl10.chm630075
vbaxl10.chm630075
Excel.ControlFormat.RemoveItem
351c2333-9e8c-90a6-90a9-839f43184bb8
04/23/2019
medium

ControlFormat.RemoveItem method (Excel)

Removes one or more items from a list box or combo box.

Syntax

expression.RemoveItem (Index, Count)

expression A variable that represents a ControlFormat object.

Parameters

Name Required/Optional Data type Description
Index Required Long The number of the first item to be removed. Valid values are from 1 to the number of items in the list (returned by the ListCount property).
Count Optional Variant The number of items to be removed, starting at item Index. If this argument is omitted, one item is removed. If Index + Count exceeds the number of items in the list, all items from Index through the end of the list are removed without an error.

Remarks

If the specified object has a fill range defined for it, this method fails.

Use the RemoveAllItems method to remove all entries from a list box or combo box.

Example

This example removes the selected item from a list box. If Shapes(2) doesn't represent a list box, this example fails.

Set lbcf = Worksheets(1).Shapes(2).ControlFormat 
lbcf.RemoveItem lbcf.ListIndex

[!includeSupport and feedback]