ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Locked Cells (https://www.excelbanter.com/excel-programming/401018-conditional-locked-cells.html)

shaqil

Conditional Locked Cells
 
Dear All,

I have a sheet in which 3 columns are for data feeding and i need that
if any body feed any item in non blank cells then it will be locked
and he couldn't alter if he fed the data once.

await for early and positive response.

Regards


Mike H

Conditional Locked Cells
 
Hi,

Firstly select A1 - A100 and then:-
Format|cells|Protection and remove the Locked checkmark.
Then right click the sheet tab, view code and paste this in:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A100")) Is Nothing Then ' Change to
suit
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="mypass"
Target.Locked = True
ActiveSheet.Protect Password:="mypass"
Application.EnableEvents = True
End If
End Sub

Changing a cell in the range A1 to A100 causes it to become locked. You can
change this range to suit

Mike

"shaqil" wrote:

Dear All,

I have a sheet in which 3 columns are for data feeding and i need that
if any body feed any item in non blank cells then it will be locked
and he couldn't alter if he fed the data once.

await for early and positive response.

Regards




All times are GMT +1. The time now is 11:58 AM.

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