Hi Jindon
Thanks for the reply.
If I right click on this mysterious Tab, it highlights “spreadsheet”, just as I get highlighted if I do the same on my of the other “normal” Tabs. It would still appear to me to be a Normal Worksheet. Just that it strangely has no code module and does not appear in the VBAProject Window.
_...
But I do see what you are saying. And I expect you are correct. Here your code again, slightly different
It shows that I have 7 Worksheets and 8 Sheets. And you are probably correct that the 8th Sheet is something else, such as possibly an Excel 4.0 Macro Sheet, or some similar „throw back” to Days gone by.
Sub ttt()
Dim wsh As Worksheet
For Each wsh In ThisWorkbook.Worksheets
MsgBox "Worksheet: " & wsh.Name
Next
MsgBox "Worksheets: " & ThisWorkbook.Worksheets.Count
For Each wsh In ThisWorkbook.Sheets
MsgBox "Sheets: " & wsh.Name
Next
MsgBox "Sheets Count: " & ThisWorkbook.Sheets.Count
End Sub
_..................................
What surprises me is that I did something similar here:
http://www.mrexcel.com/forum/lounge-...ml#post4387604
I thought with this code I was doing something similar, that is to say adding a Macro Code “sheet”.
The difference to the current situation is that the following code does not appear to give me something which “looks” like an extra Worksheet, that is to say it does not add a new Tab.
The following code Adds 2 “sheets”. The “sheet” count goes up by two. I see no new tabs. The worksheet count is not affected. But two extra Modules do appear in the VBAProject Window
The code then deletes these two modules and “sheets” with one command. The sheets count goes back down to its original. The worksheets count is not affected.
Applied to my File, I start with 7 Worksheets, and 8 Sheets
The Sheets count goes up to 10, then back to 8
The Worksheet count is unaffected
So clearly what
_ this code below adds
and
_ mysterious thing named “Makro1” I have in my uploaded file, “InsaneDikMembranes1Makro1Sh_t.xlsm” , are not the same.
' http://www.mrexcel.com/forum/lounge-v-2-0/911516-mathematics-not-universal-language-4.html#post4387604
' ‹(ożo)›
'http://www.mrexcel.com/forum/lounge-v-2-0/911516-mathematics-not-universal-language.html Count Wonk Doc.AElstein "wbcodes.xlsm"
Sub ModuleSheetsAddDelete() 'Different Count Concepts in universe
10 Dim CntS As Long, CntW As Long '
20 Let CntW = ThisWorkbook.Worksheets.Count: Let CntS = ThisWorkbook.Sheets.Count 'Both counts are the same originally ( If I have not added charts or diagrams )
MsgBox "Worksheets: " & ThisWorkbook.Worksheets.Count: MsgBox "Sheets Count: " & ThisWorkbook.Sheets.Count
' Add "Modules"
30 ThisWorkbook.Modules.Add 'A "Module" appears in the VB Editor VBAProject Window
40 ThisWorkbook.Modules.Add 'Another "Module" appears in the VB Editor VBAProject Window
50 Let CntW = ThisWorkbook.Worksheets.Count: Let CntS = ThisWorkbook.Sheets.Count 'Worksheets count stays the same: Sheet count goes up by 2
MsgBox "Worksheets: " & ThisWorkbook.Worksheets.Count: MsgBox "Sheets Count: " & ThisWorkbook.Sheets.Count
'Delete "Modules"
60 ThisWorkbook.Modules.Delete 'Seems to delete all the "Modules" we added.
'70 Application.DisplayAlerts = False 'Option to Stop me being warned about deleting a "Worksheet"!!!? ! - no worries - it only deletes the "Modules" that I just added
80 Let CntW = ThisWorkbook.Worksheets.Count: Let CntS = ThisWorkbook.Sheets.Count 'The "Counts" are back to the original
90 Application.DisplayAlerts = True
MsgBox "Worksheets: " & ThisWorkbook.Worksheets.Count: MsgBox "Sheets Count: " & ThisWorkbook.Sheets.Count
'Try to Delete "Modules" again
100 ThisWorkbook.Modules.Delete 'This errors, so presumably "Modules" Object is a "Code module"??_(ożo)_** and we have none there to be deleted
End Sub
'
'Referrences used:
'http://www.vbforums.com/showthread.php?512860-Worksheets-vs-Sheets
'http://www.mrexcel.com/forum/excel-questions/441155-what-difference-between-worksheets-sheets.html
'http **-??_(ożo)_// - Thread where shg and Rompry discussed old Code Modules...
'Count Wonk Doc.AElstein "wbcodes.xlsm"
_....................
Just an interesting curiosity. I expect what you suggest is the answer – some old no longer used thing. Strange how it suddenly “appeared by me”
Bookmarks