How can i protect sheet then unprotect cells if a cell has data in it?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I want a reliable way todo the following

Cells D7,D9,D11,D15,E5,E7,E11 are what i will call the "CELLS"

so I'm building a page that will receive one lot of data into cell M112 from an outside source, and want to stop this outside source from being able to add the data into any cell but M112.
I also want to stop any staff adding data into the sheet until they have imported the data.
I think this will be done with a page trigger but i'm not sure how

so when we go to the sheet all cells except M112 ill be protect (locked)

all i want to know is how can i have a macro that if data goes into cell M112 it unlockes the "CELLS", and if the data in M112 is deleted it locks them again??


anyideas i'm totally lost on this one?

Thanks

Tony
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hello,

this may work but it may depend on how the data gets into M112

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$M$112" And IsEmpty(Target.Value) Then
        ActiveSheet.Protect ("abc")
    Else
        ActiveSheet.Unprotect ("abc")
    End If
End Sub

this code will need to go into the relevant sheet code window. Change password or remove it as required. You will also need to unprotect cell M112.

Does it work?
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top