+ Reply to Thread
Results 1 to 3 of 3

Lock certain cells after data entry

  1. #1
    Registered User
    Join Date
    05-10-2017
    Location
    BANGALORE
    MS-Off Ver
    2016
    Posts
    21

    Lock certain cells after data entry

    Hi

    I have this excel sheet where in data entered in Columns P - S should get locked, or to be precise protected, once entered and rest of the columns be available for any changes. Please help me with a VBA code that can make this possible.
    Attached Files Attached Files

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

    Re: Lock certain cells after data entry

    With a couple of enhancements. The data is now in an excel table since tables copy down formulas, formats and validations. I added a data validation for a date > 1/1/2017 on columns P & Q.

    You cannot do any kind of data entry outside the table.

    To add a record, click on the Add Record Button. This opens up a new record where all cells except the cell in column P are unlocked. Column P is relocked because it contains a formula and we don't want the users to be able to overwrite it.

    After entering in data, Click on the Commit Record Button. You will get a warning that the columns will be locked. Last chance to change your mind. The macro also checks to make sure both columns P and Q have data. If you answer yes to the commit, then Q:R are locked.

    You can edit any cell in the table at any time except for columns P:R. Only a new "add record" row allows entry in P & Q.

    The password is "Password" - you can see in the code where you would have to change this.

    Unprotect the sheet, remove test data, reprotect the sheet with the password.
    Attached Files Attached Files
    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
    05-10-2017
    Location
    BANGALORE
    MS-Off Ver
    2016
    Posts
    21

    Re: Lock certain cells after data entry

    This is extremely good! Just what I wanted. Thanks a ton for all the efforts put in coding this.

+ 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] Lock cells with formula to prevent manual data entry into those cells.
    By jitterbug888 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2015, 12:24 AM
  2. [SOLVED] Add vba code to lock cells on data entry
    By timetoshine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-11-2014, 08:36 AM
  3. Auto Lock Cells After Data Entry
    By DixieLou in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2014, 03:39 PM
  4. Macro to auto lock cells after data entry
    By Mhofu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2013, 05:45 AM
  5. [SOLVED] Lock All Cells after data entry of a specific cell
    By celialynn in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-09-2012, 01:41 AM
  6. lock cells after data entry
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2012, 03:14 AM
  7. Auto Lock Cells after Data Entry AND Save
    By ROSH22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-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