Excel count sheets in a workbook

Closed
Muniz Reza Posts 6 Registration date Saturday September 14, 2013 Status Member Last seen November 10, 2013 - Nov 5, 2013 at 06:21 AM
 Blocked Profile - Nov 5, 2013 at 09:09 AM
how to count the no of sheets in my workbook, like a list or whatever, also get the sheet name against it,

1 response

Blocked Profile
Nov 5, 2013 at 09:09 AM
Good Morning...

I found this, right from the support page of Microsoft......Have you read any of the supporting documents?

{code}
Dim WS_Count As Integer
Dim I As Integer

' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count

' Begin the loop.
For I = 1 To WS_Count

' Insert your code here.
' The following line shows how to reference a sheet within
' the loop by displaying the worksheet name in a dialog box.
MsgBox ActiveWorkbook.Worksheets(I).Name

Next I

End Sub

{/code}


https://support.microsoft.com/en-us/help/142126/macro-to-loop-through-all-worksheets-in-a-workbook
0