Index Property

Microsoft Excel Visual Basic

Show All

Index Property

       

Index property as it applies to the PivotFormula object.

For the PivotFormula object, returns or sets the index number of the object within the PivotFormulas collection. Read/write Long.

expression.Index

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

 

Index property as it applies to all other obejcts in the Applies To list.

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

expression.Index

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

 

For information about using the Index worksheet function in Visual Basic, see Using Worksheet Functions in Visual Basic.

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 "3" in a message box.

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