ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   locked cell not locked (https://www.excelbanter.com/excel-discussion-misc-queries/213980-locked-cell-not-locked.html)

Wanna Learn

locked cell not locked
 
Hello
Below is my code
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$N$11" Then
ActiveSheet.Protect "pass"

Else
If Target.Address = "$H$41" Then
ActiveSheet.Unprotect "pass"

This is what I want to do- when person completes cell N11 active sheet is
protected - until all cells are completed to H 41. when person completes H
41 active sheet is unprotected.
the above code works, BUT it does not recognized AB 11 as a locked cell
eventhough the cell is formatted as locked. thanks


Gary''s Student

locked cell not locked
 
To Protect a cell, try something like this first:

Sub lock_um()
ActiveSheet.Unprotect
Range("A1").Locked = True
ActiveSheet.Protect
End Sub

--
Gary''s Student - gsnu200820


"Wanna Learn" wrote:

Hello
Below is my code
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$N$11" Then
ActiveSheet.Protect "pass"

Else
If Target.Address = "$H$41" Then
ActiveSheet.Unprotect "pass"

This is what I want to do- when person completes cell N11 active sheet is
protected - until all cells are completed to H 41. when person completes H
41 active sheet is unprotected.
the above code works, BUT it does not recognized AB 11 as a locked cell
eventhough the cell is formatted as locked. thanks



All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com