+ Reply to Thread
Results 1 to 3 of 3

VBA to unlock cells, run macro then re-lock them

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    50

    VBA to unlock cells, run macro then re-lock them

    Hi
    I have the following code in a worksheet of which Ive locked columns AA & AB, then password protected the worksheet. However when I run my code I keep getting a
    Please Login or Register  to view this content.
    .
    Can anybody help please....I am assuming I need some code to unlock the sheet with the password before unlocking and then re-locking the cells??

    Please Login or Register  to view this content.
    Thanks in advance

    Jen
    Last edited by arlu1201; 03-05-2013 at 03:09 AM.

  2. #2
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: VBA to unlock cells, run macro then re-lock them

    Try this

    Please Login or Register  to view this content.
    "

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA to unlock cells, run macro then re-lock them

    Hi, Jen,

    I am assuming I need some code to unlock the sheet with the password before unlocking and then re-locking the cells??
    Either that or protect the sheet on opening the workbook by using the Parameter UserInterfaceOnly:=True which would enable macros to run without unprotecting the sheet. As this is a volatile setting it needs to be done on each opening of the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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