+ Reply to Thread
Results 1 to 4 of 4

Lock and Unlock Cells with VBA

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    2

    Lock and Unlock Cells with VBA

    Hello,

    I have a worksheet that I locked with a password. I use a macro which runs and prompts the user to enter some information and it drops it into cells in column B, then highlights the next open cell in the column and locks the spreadsheet. I want to be able to add data into the column but not leave it open to editing. I essentially want to unlock the cell, enter data, and re-lock without the user being able to click anywhere else on the spreadsheet. Is that possible?

    Thanks in advance for your help.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lock and Unlock Cells with VBA

    By locked I presume you mean protected.
    Are you unticking the 'Select Locked cells' option when protecting the worksheet?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-26-2012
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Lock and Unlock Cells with VBA

    Yes, I mean protected, and I have not selected the "select locked cells" is that necessary?

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Lock and Unlock Cells with VBA

    The cells that you require to be protected must have the "Locked" property set and all others must be unlocked, then protecting the sheet will prevent those locked cells from being changed.

    Do you have a sample workbook or code?


    Google Me
    Find me located here Simon Lloyd
    and what i'm about Here
    The above is NOT a link to a forum so is NOT against Rule 13

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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