Index Property

Applies To

Arc Object, Button Object, Chart Object, ChartObject Object, CheckBox Object, DialogSheet Object, Drawing Object, DropDown Object, EditBox Object, GroupBox Object, GroupObject Object, Label Object, LegendEntry Object, Line Object, ListBox Object, Menu Object, MenuBar Object, MenuItem Object, Module Object, Name Object, OLEObject Object, OptionButton Object, Oval Object, Pane Object, Picture Object, Rectangle Object, Scenario Object, ScrollBar Object, Spinner Object, TextBox Object, Trendline Object, Window Object, Worksheet Object.

Description

Returns the index number of the object within the collection of similar objects. Read-only.

For help about using the Index worksheet function in Visual Basic, see "Using Worksheet Functions in Visual Basic" in online Help.

Example

This example displays the tab number of the sheet name that you type. For example, if Chart1 is the third tab in the active workbook, the example displays the number 3 in a message box.


sheetname = InputBox("Type a sheet name, such as Sheet12 or Module1")
MsgBox "This sheet is tab number " & Sheets(sheetname).Index