+ Reply to Thread
Results 1 to 15 of 15

protecting workbook

  1. #1
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    protecting workbook

    Hi all,
    I've got about 50 worksheets in a workbook and I'd like to protect them all.
    Problem however is that I've got buttons in my worksheets that insert rows, delete rows.
    I've also got a dynamic chart with listboxes that select data.
    When I protect my worksheets all this is disabled.

    Is there a way around this?

    This is what I've done so far :
    http://www.ozgrid.com/VBA/excel-work...rotect-all.htm
    Last edited by VBA Noob; 02-08-2009 at 06:46 PM.

  2. #2
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    I've also tried allowing addition and deleting rows when I protect a single sheet, but I think because I have loops that go through cells my program crashes cause my code cant access the cells (I think).

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: protecting workbook

    See the UserInterfaceOnly argument to the Protect method in Help.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    Hi the following is my code but it doesn't work . I'm using excel Version 2003

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    Hi sorry, I've tried the code again and it worked. However by list boxes and chart dont seem to work?
    Buttons work fine

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: protecting workbook

    There's an example workbook here

    http://www.excel-it.com/vba_examples.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    Yeah sorry, this code doesn't work too. Its the ***** list boxes that don't seem to work once I protect my worksheets. The buttons work fine though.
    Last edited by Leith Ross; 02-08-2009 at 07:42 PM. Reason: Profanity

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: protecting workbook

    Not sure what your problem is, maybe you should attach the workbook.

  9. #9
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    HI,

    Well I understand that you need my workbook to understand my problem better. However, I'm not very comfortable with publishing my workbook over the internet as it is work related.

    Also I've uploaded another workbook on this site before but no-one ever replied to that. (No disrespect intended, as I've recieved heaps of helpful tips and solutions from many others.)

    Can anyone please help me? This is just holding back my project.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: protecting workbook

    Remove any sensitive data before attaching

  11. #11
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    G'day royUk, I'm attaching my workbook to this message. HOpe you can help me. Thanks matey.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-19-2006
    Posts
    26

    Re: protecting workbook

    Not sure if our situation is same or not, but I have a workbook with many macros that I need to protect against user structural changes.

    What I did was unprotect the workbook in the code at the beginning of each macro, allowing it to run, and then protect it again at the end of each macro. As far as user is concerned, sheet is always protected, but macros also run.

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: protecting workbook

    I've added the code to protect with userinterface in your protection module. It is called when the workbook opens. Seems to work fine to me
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    Hi royUk sorry mate, still doesnt work . Everytime I try to pick a date from the listboxes i get an error message saying "The workbook is protected. Please unprotect and then try to change" something along those lines. If you want I can run it and send you the exact error message. Please I really need to get this right to finish off my project.

  15. #15
    Registered User
    Join Date
    01-11-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: protecting workbook

    "The cell or chart you are trying to change is protected and therefore read only.
    TO modify a cell or chart, first remove protection ...etc"

    THats the error message I get.
    I was trying a new approach where the unprotect module is called when the listbox dropdown is clicked. And then the listbox values are chosen by the user. After which the listbox_change module calles the protect module to put it back in protection.

    However I couldnt realy get my head around it. Any help will be greatly appreciated.

+ 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