Excel VisualBasic Script

Sub WorksheetIndex()
           Dim i As Integer
           For i = 1 To ThisWorkbook.Worksheets.Count
           MsgBox ThisWorkbook.Worksheets(i).name & _
                 " has Index = " & _
                 ThisWorkbook.Worksheets(i).Index
           Next i
     End Sub