+ Reply to Thread
Results 1 to 3 of 3

Auto lock cells after data entered and SAVED

  1. #1
    Registered User
    Join Date
    04-11-2015
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    54

    Auto lock cells after data entered and SAVED

    Hi, I have a workbook, with different sheets.
    Some of the sheets (containing input cells as well as formula cells) I want to :

    - lock cells which are not blank (with data or formulae) after file is saved, users will be prompt for password if changes need to be made on those cells
    - the whole sheet still can be selected and copied (then paste at another worksheet, this will be handled by macro)
    - user still able to add copy and paste rows containing both blank and cells with data/formula

    can this be handled by excel buttons or need to go to macro level?


    thank you very much in advance.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Auto lock cells after data entered and SAVED

    This would have to be handled by VBA using a BeforeSave event on the workbook.

    The code is going to have to loop through the cells to determine if the cells have any content. This can be a huge undertaking for an entire sheet. So it would help if there were a way to limit the range that needs to be checked. Excel Tables might help since they "know" how many rows and columns they contain.

    When you protect a sheet, you can enable things like sorting and adding rows or columns. I would record a macro that does this and clean it up and put it in the code. To unprotect the sheet, you can require a password.

    To lock and unlock cells you will have to unprotect the sheet, change the cells and protect the sheet again. This can be done in VBA, but the password will be clearly visible in the code. So you should also password protect the code itself.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    04-11-2015
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    54

    Re: Auto lock cells after data entered and SAVED

    Hi dflak,

    sorry maybe I need to rephrase my title.
    Without password, user would be able to key in empty cell, copy and paste rows (with some of the columns locked).
    Without password, whole page can be copied and paste at another dummy sheet by macro working background for report generating (a separate part I am working on).

    And after this workbook is saved, all cells with input and formula will be locked (user prompt for password to edit).

    thanks for the lead, will try and explore on it.


    While replying to this post, another idea just popped up in my head....

+ 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. Auto lock cells after data entered and SAVED
    By fedcco in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-26-2016, 07:40 AM
  2. Auto lock cells after data enter & saved
    By Calanze Gowtham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2015, 05:16 AM
  3. [SOLVED] Auto Lock Cells once data is entered not working.
    By garyreid81 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-15-2014, 02:32 PM
  4. Auto lock cells after data entry when file is saved
    By greatwent in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-31-2014, 01:27 PM
  5. auto-lock cells after time is entered so that it cannot be changed
    By VanHardy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-16-2013, 05:19 PM
  6. Auto-lock a row after data is entered
    By src16 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-25-2013, 09:50 AM
  7. How to auto lock a cell once data is entered
    By infonaurvind in forum Excel General
    Replies: 1
    Last Post: 06-08-2012, 06:57 AM

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