Lock only a few cells on a worksheet
Closed
ugn10
sgmpatnaik
- Posts
- 48
- Registration date
- Saturday October 27, 2012
- Status
- Member
- Last seen
- March 4, 2014
sgmpatnaik
- Posts
- 54
- Registration date
- Tuesday April 2, 2013
- Status
- Member
- Last seen
- November 27, 2013
Related:
- Lock only a few cells on a worksheet
- Lock cell in Excel worksheet with VB ✓ - Forum - Excel
- How to copy cells from one worksheet to another automatically - Guide
- Copy non blank cells to another worksheet vba ✓ - Forum - Excel
- In ms excel, if you want to insert the same formula in a given cell of different worksheets then which of the following action y - Guide
- Copy specific cells to separate worksheets upon 2 conditions ✓ - Forum - Excel
2 replies
Zohaib R
Mar 18, 2013 at 04:49 PM
- Posts
- 2368
- Registration date
- Sunday September 23, 2012
- Status
- Member
- Last seen
- December 13, 2018
Mar 18, 2013 at 04:49 PM
Hi,
Steps mentioned in the link that you provided viz. "Locking" or "Hiding" specific cells, will not work unless the Worksheet is password protected. I use Microsoft Excel 2010, to password protect a worksheet we need to click on "Review" tab in the top ribbon and then select "Protect Sheet" and then choose a password.
Do reply with results.
Steps mentioned in the link that you provided viz. "Locking" or "Hiding" specific cells, will not work unless the Worksheet is password protected. I use Microsoft Excel 2010, to password protect a worksheet we need to click on "Review" tab in the top ribbon and then select "Protect Sheet" and then choose a password.
Do reply with results.
sgmpatnaik
Apr 3, 2013 at 04:30 AM
- Posts
- 54
- Registration date
- Tuesday April 2, 2013
- Status
- Member
- Last seen
- November 27, 2013
Apr 3, 2013 at 04:30 AM
Hi,
I am not sure what r u going to achieve if you want to lock the cells which is mention in the d1,e9 etc
Please try the below code, if any problem please inform us
'
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
' constants
' declarations
' start
Me.Unprotect
Application.EnableEvents = False
' process
[A1:d20].Locked = True
If [A1].Value = "Un Lock" Then
[A5:A20].Locked = False
End If
If [B1].Value = "Un Lock" Then
[B5:B20].Locked = False
End If
If [C1].Value = "Un Lock" Then
[C5:C20].Locked = False
End If
If [D1].Value = "Un Lock" Then
[D5:D20].Locked = False
End If
' end
Application.EnableEvents = True
Me.Protect
End Sub
'
Thanks
Patnaik
I am not sure what r u going to achieve if you want to lock the cells which is mention in the d1,e9 etc
Please try the below code, if any problem please inform us
'
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
' constants
' declarations
' start
Me.Unprotect
Application.EnableEvents = False
' process
[A1:d20].Locked = True
If [A1].Value = "Un Lock" Then
[A5:A20].Locked = False
End If
If [B1].Value = "Un Lock" Then
[B5:B20].Locked = False
End If
If [C1].Value = "Un Lock" Then
[C5:C20].Locked = False
End If
If [D1].Value = "Un Lock" Then
[D5:D20].Locked = False
End If
' end
Application.EnableEvents = True
Me.Protect
End Sub
'
Thanks
Patnaik