Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ActiveWorkbook.Sheets.Count

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default ActiveWorkbook.Sheets.Count

Hi Yankee 428,

I checked this out and this does not seem to be the case. The only sheet
that is not listed in VBE is ThisWorkbook.

I wrote a macro to list all the sheet names in a message box:

Sub NbSheets()
Dim intI As Integer
Dim strMessage As String
strMessage = ""
MsgBox "Nb sheets: " & ActiveWorkbook.Sheets.Count & vbCrLf & _
"Nb worksheets: " & ActiveWorkbook.Worksheets.Count
' I get 9 and 10.
For intI = 1 To ActiveWorkbook.Sheets.Count
strMessage = strMessage & intI & "- " & _
Sheets(intI).Name & vbCrLf
Next intI
MsgBox strMessage
End Sub

In the resulting message, I got a name that is not in the worksheets list:
"Module". I cannot see it in the worksheets list. There are no very hidden
sheets. There are 7 forms and 7 code modules, one of which is named "Module".

So what could it be?

Thank you for your concern.

"yankee428" wrote:

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default ActiveWorkbook.Sheets.Count

Maybe this will help isolate your trouble:

Option Explicit

Sub testme01()
Dim sh As Object
Dim iCtr As Long

iCtr = 0

For Each sh In ActiveWorkbook.Sheets
iCtr = iCtr + 1
MsgBox iCtr & vbLf & sh.Name & vbLf & TypeName(sh)
Next sh

End Sub

Jac Tremblay wrote:

Hi Yankee 428,

I checked this out and this does not seem to be the case. The only sheet
that is not listed in VBE is ThisWorkbook.

I wrote a macro to list all the sheet names in a message box:

Sub NbSheets()
Dim intI As Integer
Dim strMessage As String
strMessage = ""
MsgBox "Nb sheets: " & ActiveWorkbook.Sheets.Count & vbCrLf & _
"Nb worksheets: " & ActiveWorkbook.Worksheets.Count
' I get 9 and 10.
For intI = 1 To ActiveWorkbook.Sheets.Count
strMessage = strMessage & intI & "- " & _
Sheets(intI).Name & vbCrLf
Next intI
MsgBox strMessage
End Sub

In the resulting message, I got a name that is not in the worksheets list:
"Module". I cannot see it in the worksheets list. There are no very hidden
sheets. There are 7 forms and 7 code modules, one of which is named "Module".

So what could it be?

Thank you for your concern.

"yankee428" wrote:

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default ActiveWorkbook.Sheets.Count

Hi Dave,

With your little macro, I found the problem. In a particular workbook, one
sheet is of type "Module" while all the others are of type "Worksheet". So to
prevent my macro to get an error, I will only process the worksheets. But I
wander why this is possible. There are other modules in that workbook and
they are not listed in the sheets list. There are user forms to... Do you (or
anyone) have an idea why and how this happened?

Thanks

"Dave Peterson" wrote:

Maybe this will help isolate your trouble:

Option Explicit

Sub testme01()
Dim sh As Object
Dim iCtr As Long

iCtr = 0

For Each sh In ActiveWorkbook.Sheets
iCtr = iCtr + 1
MsgBox iCtr & vbLf & sh.Name & vbLf & TypeName(sh)
Next sh

End Sub

Jac Tremblay wrote:

Hi Yankee 428,

I checked this out and this does not seem to be the case. The only sheet
that is not listed in VBE is ThisWorkbook.

I wrote a macro to list all the sheet names in a message box:

Sub NbSheets()
Dim intI As Integer
Dim strMessage As String
strMessage = ""
MsgBox "Nb sheets: " & ActiveWorkbook.Sheets.Count & vbCrLf & _
"Nb worksheets: " & ActiveWorkbook.Worksheets.Count
' I get 9 and 10.
For intI = 1 To ActiveWorkbook.Sheets.Count
strMessage = strMessage & intI & "- " & _
Sheets(intI).Name & vbCrLf
Next intI
MsgBox strMessage
End Sub

In the resulting message, I got a name that is not in the worksheets list:
"Module". I cannot see it in the worksheets list. There are no very hidden
sheets. There are 7 forms and 7 code modules, one of which is named "Module".

So what could it be?

Thank you for your concern.

"yankee428" wrote:

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default ActiveWorkbook.Sheets.Count

Did that workbook start as xl95?

Try running Rob Bovey's code cleaner against your workbook--it exports, deletes
modules and reimports your code. (you can also do it manually)

I'd try running Rob Bovey's codecleaner:
http://www.appspro.com/


And see what happens next time you run that little macro.

===
xl95 had code on module sheets. xl97 introduced the VBE.

Jac Tremblay wrote:

Hi Dave,

With your little macro, I found the problem. In a particular workbook, one
sheet is of type "Module" while all the others are of type "Worksheet". So to
prevent my macro to get an error, I will only process the worksheets. But I
wander why this is possible. There are other modules in that workbook and
they are not listed in the sheets list. There are user forms to... Do you (or
anyone) have an idea why and how this happened?

Thanks

"Dave Peterson" wrote:

Maybe this will help isolate your trouble:

Option Explicit

Sub testme01()
Dim sh As Object
Dim iCtr As Long

iCtr = 0

For Each sh In ActiveWorkbook.Sheets
iCtr = iCtr + 1
MsgBox iCtr & vbLf & sh.Name & vbLf & TypeName(sh)
Next sh

End Sub

Jac Tremblay wrote:

Hi Yankee 428,

I checked this out and this does not seem to be the case. The only sheet
that is not listed in VBE is ThisWorkbook.

I wrote a macro to list all the sheet names in a message box:

Sub NbSheets()
Dim intI As Integer
Dim strMessage As String
strMessage = ""
MsgBox "Nb sheets: " & ActiveWorkbook.Sheets.Count & vbCrLf & _
"Nb worksheets: " & ActiveWorkbook.Worksheets.Count
' I get 9 and 10.
For intI = 1 To ActiveWorkbook.Sheets.Count
strMessage = strMessage & intI & "- " & _
Sheets(intI).Name & vbCrLf
Next intI
MsgBox strMessage
End Sub

In the resulting message, I got a name that is not in the worksheets list:
"Module". I cannot see it in the worksheets list. There are no very hidden
sheets. There are 7 forms and 7 code modules, one of which is named "Module".

So what could it be?

Thank you for your concern.

"yankee428" wrote:

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay


--

Dave Peterson



--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default ActiveWorkbook.Sheets.Count

Hi Dave,

Yes, I think it did. As a matter of fact, it must have. That is a good
point. I will effectively try Rob's code cleaner on those workbooks (there
are 60 of them) that cause problem.

That is a very interesting comment. I really appreciate.

Thank you Dave.

"Dave Peterson" wrote:

Did that workbook start as xl95?

Try running Rob Bovey's code cleaner against your workbook--it exports, deletes
modules and reimports your code. (you can also do it manually)

I'd try running Rob Bovey's codecleaner:
http://www.appspro.com/


And see what happens next time you run that little macro.

===
xl95 had code on module sheets. xl97 introduced the VBE.

Jac Tremblay wrote:

Hi Dave,

With your little macro, I found the problem. In a particular workbook, one
sheet is of type "Module" while all the others are of type "Worksheet". So to
prevent my macro to get an error, I will only process the worksheets. But I
wander why this is possible. There are other modules in that workbook and
they are not listed in the sheets list. There are user forms to... Do you (or
anyone) have an idea why and how this happened?

Thanks

"Dave Peterson" wrote:

Maybe this will help isolate your trouble:

Option Explicit

Sub testme01()
Dim sh As Object
Dim iCtr As Long

iCtr = 0

For Each sh In ActiveWorkbook.Sheets
iCtr = iCtr + 1
MsgBox iCtr & vbLf & sh.Name & vbLf & TypeName(sh)
Next sh

End Sub

Jac Tremblay wrote:

Hi Yankee 428,

I checked this out and this does not seem to be the case. The only sheet
that is not listed in VBE is ThisWorkbook.

I wrote a macro to list all the sheet names in a message box:

Sub NbSheets()
Dim intI As Integer
Dim strMessage As String
strMessage = ""
MsgBox "Nb sheets: " & ActiveWorkbook.Sheets.Count & vbCrLf & _
"Nb worksheets: " & ActiveWorkbook.Worksheets.Count
' I get 9 and 10.
For intI = 1 To ActiveWorkbook.Sheets.Count
strMessage = strMessage & intI & "- " & _
Sheets(intI).Name & vbCrLf
Next intI
MsgBox strMessage
End Sub

In the resulting message, I got a name that is not in the worksheets list:
"Module". I cannot see it in the worksheets list. There are no very hidden
sheets. There are 7 forms and 7 code modules, one of which is named "Module".

So what could it be?

Thank you for your concern.

"yankee428" wrote:

Jac,

You probably have a Very Hidden Sheet.

Go into the VBE. In the project window every worksheet in the workbook will
be listed here. Find the one that does not have a worksheet tab in Excel.
Back in VBE, in the project window, click on the missing Sheet. Now look at
the Properties window, the Visible attribute is either xlSheetHidden or
xlSheetVeryHidden. Change it to xlSheetVisible.

"Jac Tremblay" wrote:

A little more on this question...

I figured that there is a difference between "Sheets" and "Worksheets". Ok.
But, now, there are 10 sheets and 9 worksheets. So where is the 10th sheet?
How do I display it or, if this is not possible, how do I get to know what it
is? What type of sheet?

Thanks.

"Jac Tremblay" wrote:

Hi everyone,

When I execute the code: "ActiveWorkbook.Sheets.Count", I get 10 while there
are only 9. The workbook and the sheets are not password protected and there
are no hidden sheets either.

I am using Excel XP and Windows XP.

What could the problem be?
--
Jac Tremblay

--

Dave Peterson



--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveWorkBook Pete Excel Discussion (Misc queries) 3 May 9th 05 04:14 PM
ActiveWorkbook.Close dallas Excel Programming 0 November 3rd 04 06:27 PM
ActiveWorkbook.Close dallas Excel Programming 2 November 3rd 04 05:56 PM
Activeworkbook.Saved Jack Clift Excel Programming 4 February 5th 04 08:42 AM
Activeworkbook.sendmail Jamie[_5_] Excel Programming 2 October 2nd 03 01:25 PM


All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"