Quote Originally Posted by Aussiebear View Post
From my understanding of this section, you are seeking a boolean button effect to run the macro. That is, pressed once it caused one effect, and when pressed again, it causes another effect. My interpretation of your code is that you are seeking a method preventing some users, from seeing the formulas used in your workbook.



Again I'm struggling to understand what you are wanting here, is it that the sheets are known beforehand, or are you wanting to select the sheets on each occasion?

If you want to protect known sheets (say, "Moscow", "London", "Italy" & "New Zealand", then list them in an array as SamT has kindly shown you, otherwise you need to provide a method for the User to select on the run.
Hello Aussiebear
idea is the following of my excel file:
Assume that we are in London (UK), in England there are many cities.
We have 200 people working any products in every city (evenly distributed).
Several of us, however, work on special concrete products in the same cities that do not work on other people.
In a workbook we have many worksheets named with names of specific cities + other data.
Each of these worksheets in column A (in particular rows) are exactly the same only different cities (the names of the sheets).
At the end of each month, this file is sent to be examined by any person (representative).
In macros that I have shown and trying to do before I can send files to hide shown me lines (because there are products that should not be visible to others) and to lock all worksheets with names of cities.
Yes I have and I know the names of the worksheets to be hidden (rows) and locked worksheets.
In my macro so long (which is good for nothing) - the short version:
Only one button
macro to loop through all the worksheets with names of cities (I have to write it down in the macro what those cities) want to hide my rows and lock all worksheets (with city names).
Second macro - it unlock all the worksheets with the names of cities and unhide the hidden rows.

SamT
you write password of a workbook, and I do not have one (excel file is unlocked), I have (ie I want to have passwords worksheets - only selected sheets with names of cities).
I tried but your macro:
When I press the button once - as I I go up the word "write your password" then none of the sheets with names of cities not hide any mention of the desired row and lock them.
This is precisely why I asked if I wrong somewhere?
In the macro there were two mistakes that spelling is one that you mention, and the other (GotoUnHideSheets) and I fixed it for her (Goto UnHideSheets).
Please wholeheartedly look at my unworkmanlike macro that I put after hiding rows password worksheets and in your macro I dont see setting a password for worksheets.
Ie in the example that I gave put (write) password "kosta".
Thank you all for your support, I believe we can find a solution.
If you have more questions ask, I will answer, I just do not believe that I can create so many cares one macro.
Thanks again.