+ Reply to Thread
Results 1 to 8 of 8

Protect/Unprotect Sheets in array with VBA

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Protect/Unprotect Sheets in array with VBA

    Hi all,

    I want to protect or unprotect a number of sheets by using a Macro. I don't want to unprotect ALL sheets, but only certain sheets within my workbook. Below is the code that I have come up with. It does not seem to work yet, can someone help me fix it?

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Protect/Unprotect Sheets in array with VBA

    This method also does not seem to work...

    Please Login or Register  to view this content.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Protect/Unprotect Sheets in array with VBA

    This should do it.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Protect/Unprotect Sheets in array with VBA

    Now it says "variable not defined". What do I need to defined it as?

    Please Login or Register  to view this content.
    Does not seem to work...

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Protect/Unprotect Sheets in array with VBA

    I never use Option Explicit so not used defining variables.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Protect/Unprotect Sheets in array with VBA

    now it says: "Object doesn't support this property or method..."

  7. #7
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Protect/Unprotect Sheets in array with VBA

    It's working now! had a tiny spelling error... Thanks!!

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Protect/Unprotect Sheets in array with VBA

    You're welcome and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Made a VBA code to protect sheets... now I can't unprotect the sheets
    By ferocity02 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-25-2017, 08:17 PM
  2. VBA to unprotect sheets x 2, refresh data then protect sheets
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-18-2016, 08:38 AM
  3. [SOLVED] Protect/Unprotect sheets
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-17-2014, 07:33 PM
  4. [SOLVED] Macro to Unprotect sheets-unlock range of cells-protect sheets
    By jrace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2013, 10:45 AM
  5. [SOLVED] protect/unprotect all sheets
    By wayneg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-03-2012, 08:20 AM
  6. [SOLVED] Password protect and unprotect all sheets EXCEPT two named sheets
    By Ducatisto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2012, 05:43 AM
  7. protect/unprotect all sheets
    By roos in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2006, 06:50 PM

Tags for this Thread

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