+ Reply to Thread
Results 1 to 7 of 7

Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

  1. #1
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Hello friends,

    I'm stuck. Kindly assist. Excel sheet attached

    I will like help with a VBA codes or script such that when Cell "C19" returns 'FAIL', cells C21 to 26, C29 to C36, C39 to C58 will be locked from further editing else if it returns 'PASS' then the cells can be further editable

    I would also like to have a POP UP message prompt like 'You may not proceed' when "C19" shows fail

    Thank you

    Best Regards,
    Oloyejawnson
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Swift assistance would be highly appreciated..

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    I am away from my PC so cannot download your file, but this is one way to do what you want.

    Use a change event macro in the sheet module - this one
    Please Login or Register  to view this content.
    The UNION function allows you to join your various ranges into one range, use commas to separate your ranges.
    Please Login or Register  to view this content.
    This would remove any edit from a "locked" cell
    Please Login or Register  to view this content.
    Click on this solved thread where the OP wanted something similar
    Last edited by kev_; 02-20-2018 at 05:37 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Hello Kev,
    Thank you so much. Appreciate

    However, I'm unable to run or apply the codes as the macro is not showing on the Macro list when I try to run the script. Am I missing something?

    Please what can I do?

    See screenshot below.. thanx!


    Change Macro.PNG
    Macro.PNG

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Here is a complete macro for you
    Test in attached workbook
    I have included dropdown in C19 with "Pass" and "Fail" as possible values

    Macro is in the sheet module (right click on sheet tab \ View Code to see it)
    It is an event macro
    You do not run it - it is triggerred automatically
    It does not appear in the list of macros ("Private" prevents it being visible)
    EnableEvents=False prevents the macro cell edits triggering the macro again
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 02-21-2018 at 03:33 AM.

  6. #6
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Thanks a bunch Kev.. it works fine now!

    Cheers bro!

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Lock/Unlock If Or Else Criteria [PLEASE ASSIST]

    Good
    Please mark thread SOLVED (click ThreadTools at Top of Thread)

+ 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 and Unlock several cells when a value is given
    By Mr_Focal in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2015, 11:33 AM
  2. Lock Unlock Row
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2012, 03:57 PM
  3. Lock and Unlock Cells with VBA
    By gelinasc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2012, 09:40 PM
  4. Excel Lock & Unlock
    By sugavanam in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2011, 10:28 AM
  5. Lock/Unlock some cells in a row
    By processchip in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2011, 01:05 PM
  6. Lock or unlock cell in vba
    By peejay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2007, 05:34 PM
  7. [SOLVED] Lock and Unlock cells using VBA
    By Peter in forum Excel General
    Replies: 1
    Last Post: 01-29-2005, 10:06 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