+ Reply to Thread
Results 1 to 10 of 10

simultaneous protection

  1. #1
    Forum Contributor
    Join Date
    10-03-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    105

    simultaneous protection

    I have set up a workbook containing 15 sheets. 12 of them are named Jan to Dec. I KNOW how to protect each one, but is it possible to protect all twelve in one go ?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: simultaneous protection

    VBA Code is required because you cannot select all the sheets and select protect.
    You can loop through the sheets and protect them.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-03-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: simultaneous protection

    Thank you Dave
    for
    1. establishing the impossibility of using a function/technique
    and
    2. for giving me an alternative.

    It will be a challenge for me to 'deploy' the script (?),
    but I will try,
    and WHEN I fail,
    will tell you what bungling resulted in failure.

  4. #4
    Forum Contributor
    Join Date
    10-03-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: simultaneous protection

    I opened the first sheet of the workbook
    right-clicked the sheet tab
    selected 'view code'
    pasted your code into the blank page that opened
    replaced 'Dim' with the name of the first sheet in the workbook
    replaced 'activeworkbook' with the name of the excelfile, (EXCLUDING '.xls')
    Saved the subroutine
    That caused the CHANGED 'Dim sh As Worksheet' to appear in red font
    Clicked File menu and selected 'Close and return to MSExcel'
    WHAT NOW ?
    That sheet still is unprotected.

    Please suffer fools kindly.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: simultaneous protection

    Press Alt & F11
    Go to insert=>Module, paste the code there.
    Press Alt & F11 again to get back to Excel
    Press Alt & F8 to select a macro to run, select the macro and run it.

  6. #6
    Forum Contributor
    Join Date
    10-03-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: simultaneous protection

    MAGIC !
    Excellent
    Thank you
    And without ANY subsitutions !

    F.Y.I.
    Even though the macro was effective,
    when I reopened the workbook
    there was a warning message
    that the sedcurity level is too high for macros to work
    YET it had worked !

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: simultaneous protection

    set macro security to "medium", then you can decide on a file by file basis whether you want to run macros for the file or not!

  8. #8
    Forum Contributor
    Join Date
    10-03-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: simultaneous protection

    teylyn
    I was drawing attention to the paradoxical fact that the macro had worked, yet I got the warning to first alter secirity !

    In my fumbling to find the 'scale' to enhance Dave's reputation, I accidentally clicked 'mine' and got the enigmatic statement that I had ten points - for what ? - for asking a challenging question ?

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: simultaneous protection

    Sebastian, I think the macro ran the first time because you installed the code and ran it before you closed the workbook. Then when you opened it again, macro security checke in.

    Everbody starts out with 10 points. It's the forum default and makes you feel a lot better than 0 points

  10. #10
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: simultaneous protection

    Your thread has been moved and renamed to here,
    http://www.excelforum.com/excel-gene...s-enabled.html

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1