Announcement

Collapse
No announcement yet.

Lock/protect active sheet if value on cell meet

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lock/protect active sheet if value on cell meet



    Hello to all,

    I'm new to VBA but can understand some.
    I need help regarding locking/protecting the active sheet when the value on cell matches my required value.
    For example,
    The value will appear on column D. If a value appear on D is "REJECT" the active sheet will become protected.
    But before the value on D appear, it must satisfy the condition on column B and C. Cells on column B and C are under formula as well as column D.
    The data on column B is dependent on column A1 and data on column C is dependent on A2.
    Pls see below
    A B C D
    1 1 OK OK ACCEPT
    2 1
    3 1 OK NG REJECT
    4 2
    5









    Data on column A are from scanner, so I need to finish scanning to have data on column B and C and to have data on column D.

    Thanks in advance for any help you could give me.

  • #2
    It would be easier to help and test possible solutions if you could attach a copy of your file.
    You can say "THANK YOU" for help received by clicking "Like" in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

    Comment


    • #3
      Hi Mumps
      Thank you for your reply.
      Pls see attached sample file.
      Attached Files

      Comment


      • #4
        Try the attached file. I had to unmerge the cells in column D in order to get the macro to work. You should avoid using merged cells at all cost because they create havoc for Excel macros. Once the sheet is protected and locked, you will not be able to enter any data anywhere on the sheet. You will have to decide how you want to unprotect it and unlock it.
        Attached Files
        You can say "THANK YOU" for help received by clicking "Like" in the bottom right corner of the helper's post.
        Practice makes perfect. I am very far from perfect so I'm still practising.

        Comment


        • #5
          Thanks a lot Mumps

          Comment


          • #6


            You are very welcome.
            You can say "THANK YOU" for help received by clicking "Like" in the bottom right corner of the helper's post.
            Practice makes perfect. I am very far from perfect so I'm still practising.

            Comment

            Working...
            X