I have the following module:
this is designed to give me a total count of worksheets in a workbook.
The problem is that I have multiple workbooks using this command, and I've realized now that when I use it on one workbook, it takes those values and places them in ALL workbooks, which is causing inaccurate results to be displayed everywhere it's used EXCEPT whatever sheet I'm currently working on (as it does the formula for that sheet)
for example:
I create workbook 1. when done, it has 5 worksheets total. I put in the formula where I want it and it displays (accurately) "5"
I then create workbook 2 while workbook 1 is still open. Workbook 2 has 3 sheets. When done creating and filling it with info, I put the formula where I want it in workbook 2. It calculates "3".
the issue, is it takes that "3" and plugs it into both workbook 1 and workbook 2's cells that contain the shtcnt() function.
The end result is worksheet 2 has the correct information, but workbook 1 now displays "3" instead of "5"
How would i stop it from doing this? The only Idea I have is to create a "shtcnt1()" "shtcnt2" etc etc for every worksheet I create, but that's not very practical
Bookmarks