+ Reply to Thread
Results 1 to 4 of 4

VBA Protect/Unprotect worksheet

  1. #1
    Registered User
    Join Date
    12-03-2013
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2013
    Posts
    2

    VBA Protect/Unprotect worksheet

    Hi

    I have a small problem.

    In my vba code I use the following.

    ActiveSheet.Unprotect Password = "1234" and
    ActiveSheet.Protect Password = "1234"

    Which Works just fine.

    But when I want to unprotect manually it says the password is incorrrect.

    Any idea why?

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA Protect/Unprotect worksheet

    This is because your password is really "Falsk". The code is incorrect - it passes an expression rather than a named argument. Change the code to this:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: VBA Protect/Unprotect worksheet

    Try this VBA

    place in a Module

    Please Login or Register  to view this content.

    Then place this in your sheet
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-03-2013
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: VBA Protect/Unprotect worksheet

    Thanks a lot, that solved my problem.

+ 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. [SOLVED] Trying to use VB to protect and Unprotect a worksheet
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 09:44 AM
  2. Protect and Unprotect Worksheet VBA
    By s45yth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2011, 07:20 PM
  3. Protect/Unprotect worksheet
    By mab in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2010, 06:21 PM
  4. How to protect and unprotect worksheet
    By ballack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2007, 08:35 AM
  5. [SOLVED] protect/unprotect worksheet
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2005, 02:05 PM

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