+ Reply to Thread
Results 1 to 4 of 4

Lock cell in range(s) after input issue

  1. #1
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Lock cell in range(s) after input issue

    Hello

    I have had some excellent help setting up the attached file with code that locks the cells in the range after input. This works as intended (example B9).....except for an instance where the user does not input anything and presses other keys like the delete key (example C9) This results in the cell being locked even though there was nothing inputted in the cell. Subsequently nothing can be inputted in that cell until the admin unlocks. is there a way to modify the code to prevent this issue
    (Ideally the best case scenario would be to lock only if the cell above has passed the data verification for that cell )

    The current code is below

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("b9:h9, b12:h12, b19:h19, b21:h21, b31:h31")) Is Nothing Then Exit Sub
    ActiveSheet.Unprotect Password:="cream"
    Target.Locked = True
    ActiveSheet.Protect Password:="cream"
    End Sub
    Attached Files Attached Files
    Last edited by diddy47; 04-06-2019 at 06:26 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Lock cell in range(s) after input issue

    Maybe try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Re: Lock cell in range(s) after input issue

    great, this seems to do the trick, the unintended aspect no longer occurs...thank you

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Lock cell in range(s) after input issue

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.
    Last edited by TMS; 04-05-2019 at 06:17 PM.

+ 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 cell in range(s) after input
    By diddy47 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2019, 01:48 PM
  2. lock/unlock cell based on another cells input
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-21-2013, 03:17 PM
  3. [SOLVED] Lock cell(s) after data input using macro.
    By kawaitang in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 02:44 PM
  4. User to input character "A", but cell will show time stamp, and lock the cell.
    By matrix1108 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2012, 01:02 PM
  5. Conditional Formatting - Grey Out and Lock A range based on a cell value in that range
    By Excelgnome in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2012, 07:31 PM
  6. Lock cell issue
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2011, 04:05 AM
  7. Conditionally lock cells based on value in input cell
    By mbrady1973 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-09-2008, 06:54 PM

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