How do I protect cells once data input.

ghrek

Active Member
Joined
Jul 29, 2005
Messages
298
Hi I have posted on here but dont understand. How do I lock cells once data input [SOLVED]

What it is I have a workbook that already has protected cells but what im trying to do is when data is input into UNPROTECTED cells I need them protected too.

When I clear on clear cells macro I need the ones that were protected to be unprotected and cleared.

All the cells that are unprotected and need protecting when data input are in bold borders.

Any Ideas? Link to workbook below...

 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Oddball2020

Board Regular
Joined
May 6, 2021
Messages
69
Office Version
  1. 365
Platform
  1. Windows
Hope this helps as some examples how to unlock and lock sheets w/ password protection in VBA:

VBA Code:
'Unlock all sheets in workbook
    Dim i As Long
    
    For i = 1 To Sheets.Count
        Sheets(i).Unprotect Password = "Password"
    Next i


'Locks Certain Cells or Ranges

Worksheets("Summary").Range("F7").Locked = False    'use before if there's cells you don't want locked, otherwise skip

Sheets("Summary").Protect Password = "Password"   'lock using password in macro
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
60,321
Office Version
  1. 365
Platform
  1. Windows
@Oddball2020
In what way has that got anything to do with the OP's request?
 

Oddball2020

Board Regular
Joined
May 6, 2021
Messages
69
Office Version
  1. 365
Platform
  1. Windows
@Oddball2020
In what way has that got anything to do with the OP's request?
He's talking about locking/unlocking cells on the sheet... I assumed he would be using VBA as a solution. I know I didn't solve it for him, but was just providing some VBA that he could use along those lines if he wanted. If it's not an appropriate post, please delete it, thanks!
 

Forum statistics

Threads
1,137,125
Messages
5,679,751
Members
419,855
Latest member
Eddier32

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
Top