ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   total no of worksheets in the workbook (https://www.excelbanter.com/excel-programming/298008-total-no-worksheets-workbook.html)

No Name

total no of worksheets in the workbook
 
Hi

i am trying to find out the total no of worksheets in the
workbook...i have in total 4 worksheets... but somehow its
giving me incorrect value of 9...the total count instaead
of 4 is comign to be 9........

what could be the reason..
here is how i am getting it:

cntB = Workbooks(uuWkBkName).Worksheets.Count
cntB = ActiveWorkbook.Worksheets.Count

i have used this before and was never a problem..only
today its giving me this absurd error!

thanks in advance


Nigel[_8_]

total no of worksheets in the workbook
 
Worksheets.Count will count visible and hidden sheets (both hidden and very
hidden) - is this the problem?

Cheers
Nigel

wrote in message
...
Hi

i am trying to find out the total no of worksheets in the
workbook...i have in total 4 worksheets... but somehow its
giving me incorrect value of 9...the total count instaead
of 4 is comign to be 9........

what could be the reason..
here is how i am getting it:

cntB = Workbooks(uuWkBkName).Worksheets.Count
cntB = ActiveWorkbook.Worksheets.Count

i have used this before and was never a problem..only
today its giving me this absurd error!

thanks in advance




No Name

total no of worksheets in the workbook
 
ok..yah maybe u r rite...
i wasnt aware that worksheets can also be hidden.. i tried
to findout the hidden sheets....couldnt find the way to
see hidden sheets

hwo do i see the hidden worksheets?

thanks a lot!
-----Original Message-----
Worksheets.Count will count visible and hidden sheets

(both hidden and very
hidden) - is this the problem?

Cheers
Nigel

wrote in message
...
Hi

i am trying to find out the total no of worksheets in

the
workbook...i have in total 4 worksheets... but somehow

its
giving me incorrect value of 9...the total count

instaead
of 4 is comign to be 9........

what could be the reason..
here is how i am getting it:

cntB = Workbooks(uuWkBkName).Worksheets.Count
cntB = ActiveWorkbook.Worksheets.Count

i have used this before and was never a problem..only
today its giving me this absurd error!

thanks in advance



.


mudraker[_214_]

total no of worksheets in the workbook
 
To help you identify the sheets try something like this


Sub ddddd()
Dim wS As Worksheet
For Each wS In Worksheets
wS.Visible = xlSheetVisible
Debug.Print wS.Name
Next

End Su

--
Message posted from http://www.ExcelForum.com


No Name

total no of worksheets in the workbook
 
i figured it out..
i need to go to format--sheet!

thanks
-----Original Message-----
ok..yah maybe u r rite...
i wasnt aware that worksheets can also be hidden.. i

tried
to findout the hidden sheets....couldnt find the way to
see hidden sheets

hwo do i see the hidden worksheets?

thanks a lot!
-----Original Message-----
Worksheets.Count will count visible and hidden sheets

(both hidden and very
hidden) - is this the problem?

Cheers
Nigel

wrote in message
...
Hi

i am trying to find out the total no of worksheets in

the
workbook...i have in total 4 worksheets... but somehow

its
giving me incorrect value of 9...the total count

instaead
of 4 is comign to be 9........

what could be the reason..
here is how i am getting it:

cntB = Workbooks(uuWkBkName).Worksheets.Count
cntB = ActiveWorkbook.Worksheets.Count

i have used this before and was never a problem..only
today its giving me this absurd error!

thanks in advance



.

.



All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com