A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Lock Cell After Data is Entered on Particular Cell



 
 
Thread Tools Display Modes
  #1  
Old June 24th 12, 01:00 PM
Moideen Moideen is offline
Member
 
First recorded activity by ExcelBanter: Mar 2012
Posts: 36
Default Lock Cell After Data is Entered on Particular Cell

We are maintaing an excel sheet for expense details, After Entering the data on Amount Coloumn Need to Lock The Amount Coloumn with Password.
Please help me.

Coloumn 1 Coloumn 2 Coloumn 3

Date Item Name Amount
Ads
  #2  
Old June 24th 12, 02:55 PM posted to microsoft.public.excel.worksheet.functions
WoolyBully
external usenet poster
 
Posts: 2
Default Lock Cell After Data is Entered on Particular Cell

On Sun, 24 Jun 2012 12:00:21 +0000, Moideen
> wrote:

>
>We are maintaing an excel sheet for expense details, After Entering the
>data on Amount Coloumn Need to Lock The Amount Coloumn with Password.
>Please help me.
>
>Coloumn 1 Coloumn 2 Coloumn 3
>
>Date Item Name Amount



Unlock cell, add data, re-lock cell.

All has to be by code. No auto-function for this. You must visit the
programming sub-group.
  #3  
Old June 24th 12, 03:08 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben[_2_]
external usenet poster
 
Posts: 623
Default Lock Cell After Data is Entered on Particular Cell

First...........select all cells on sheet and format them to unlocked.

Add this event code to the worksheet module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then
ActiveSheet.Unprotect Password:="justme"
n = Target.Row
If Me.Range("C" & n).Value <> "" Then
Me.Range("C" & n).Locked = True
End If
End If
enditall:
ActiveSheet.Protect Password:="justme"
Application.EnableEvents = True
End Sub

When you enter a value in column C that cell will become locked for
editing.


Gord


On Sun, 24 Jun 2012 12:00:21 +0000, Moideen
> wrote:

>
>We are maintaing an excel sheet for expense details, After Entering the
>data on Amount Coloumn Need to Lock The Amount Coloumn with Password.
>Please help me.
>
>Coloumn 1 Coloumn 2 Coloumn 3
>
>Date Item Name Amount

  #4  
Old June 24th 12, 03:31 PM posted to microsoft.public.excel.worksheet.functions
CellShocked
external usenet poster
 
Posts: 277
Default Lock Cell After Data is Entered on Particular Cell

On Sun, 24 Jun 2012 07:08:06 -0700, Gord Dibben > wrote:

>First...........select all cells on sheet and format them to unlocked.
>
>Add this event code to the worksheet module.
>
>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>On Error GoTo enditall
>Application.EnableEvents = False
>If Target.Cells.Column = 3 Then
>ActiveSheet.Unprotect Password:="justme"
> n = Target.Row
> If Me.Range("C" & n).Value <> "" Then
> Me.Range("C" & n).Locked = True
> End If
> End If
>enditall:
>ActiveSheet.Protect Password:="justme"
>Application.EnableEvents = True
>End Sub
>
>When you enter a value in column C that cell will become locked for
>editing.
>
>
>Gord
>
>
>On Sun, 24 Jun 2012 12:00:21 +0000, Moideen
> wrote:
>
>>
>>We are maintaing an excel sheet for expense details, After Entering the
>>data on Amount Coloumn Need to Lock The Amount Coloumn with Password.
>>Please help me.
>>
>>Coloumn 1 Coloumn 2 Coloumn 3
>>
>>Date Item Name Amount



Still seems quite vulnerable.
  #5  
Old June 24th 12, 06:19 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben[_2_]
external usenet poster
 
Posts: 623
Default Lock Cell After Data is Entered on Particular Cell

On Sun, 24 Jun 2012 07:31:47 -0700, CellShocked
<[email protected] org> wrote:

> Still seems quite vulnerable.


In what manner other than the weakness of Excel's internal security
which is always the issue.

OP can lock the project from viewing so's users cannot see the
password.


Gord


  #6  
Old June 25th 12, 02:26 AM posted to microsoft.public.excel.worksheet.functions
GS[_2_]
external usenet poster
 
Posts: 3,516
Default Lock Cell After Data is Entered on Particular Cell

How would the user edit an incorrect entry in the amount column?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #7  
Old June 25th 12, 01:29 PM
Moideen Moideen is offline
Member
 
First recorded activity by ExcelBanter: Mar 2012
Posts: 36
Default

Quote:
Originally Posted by Gord Dibben[_2_] View Post
First...........select all cells on sheet and format them to unlocked.

Add this event code to the worksheet module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then
ActiveSheet.Unprotect Password:="justme"
n = Target.Row
If Me.Range("C" & n).Value <> "" Then
Me.Range("C" & n).Locked = True
End If
End If
enditall:
ActiveSheet.Protect Password:="justme"
Application.EnableEvents = True
End Sub

When you enter a value in column C that cell will become locked for
editing.


Gord


On Sun, 24 Jun 2012 12:00:21 +0000, Moideen
> wrote:

>
>We are maintaing an excel sheet for expense details, After Entering the
>data on Amount Coloumn Need to Lock The Amount Coloumn with Password.
>Please help me.
>
>Coloumn 1 Coloumn 2 Coloumn 3
>
>Date Item Name Amount
Dear Gord ,

Thank you very much, It's Function working well, But i unprotected the work sheet with the password of "justme" and excel opening time need auto protection if i forgot to protect the sheet before excel closing time.
your kindly help is highly appreciated
  #8  
Old June 25th 12, 09:16 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben[_2_]
external usenet poster
 
Posts: 623
Default Lock Cell After Data is Entered on Particular Cell

On Mon, 25 Jun 2012 12:29:45 +0000, Moideen
> wrote:

>Dear Gord ,
>
>Thank you very much, It's Function working well, But i unprotected the
>work sheet with the password of "justme" and excel opening time need
>auto protection if i forgot to protect the sheet before excel closing
>time.
>your kindly help is highly appreciated


Copy/paste this event code to Thisworkbook module.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("yoursheetname").Protect Password:="justme"
End Sub

NOTE: as others have pointed out, Excel's internal security is quite
weak and protection of cells and sheets will serve only to prevent
accidental overwriting of formulas or data.

A user determined to change data can easily crack the password
protection.

GS also asked "how will user correct a mistake in data entry if cells
are locked"?

What will you do if users do not enable VBA when they open the
workbook?

Have you considered these issues?


Gord
  #9  
Old June 26th 12, 11:08 AM
Moideen Moideen is offline
Member
 
First recorded activity by ExcelBanter: Mar 2012
Posts: 36
Default

Quote:
Originally Posted by Gord Dibben[_2_] View Post
On Mon, 25 Jun 2012 12:29:45 +0000, Moideen
> wrote:

>Dear Gord ,
>
>Thank you very much, It's Function working well, But i unprotected the
>work sheet with the password of "justme" and excel opening time need
>auto protection if i forgot to protect the sheet before excel closing
>time.
>your kindly help is highly appreciated


Copy/paste this event code to Thisworkbook module.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("yoursheetname").Protect Password:="justme"
End Sub

NOTE: as others have pointed out, Excel's internal security is quite
weak and protection of cells and sheets will serve only to prevent
accidental overwriting of formulas or data.

A user determined to change data can easily crack the password
protection.

GS also asked "how will user correct a mistake in data entry if cells
are locked"?

What will you do if users do not enable VBA when they open the
workbook?

Have you considered these issues?


Gord
Dear Gord,

Thank you once again for your quick response,We are not facing these types of issues, Because this is not a highly important file.
  #10  
Old October 19th 13, 09:49 PM
Jimmy Duncan Jimmy Duncan is offline
Junior Member
 
First recorded activity by ExcelBanter: Oct 2013
Posts: 1
Default

[quote='Gord Dibben[_2_];1603079']First...........select all cells on sheet and format them to unlocked.

Add this event code to the worksheet module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then
ActiveSheet.Unprotect Password:="justme"
n = Target.Row
If Me.Range("C" & n).Value <> "" Then
Me.Range("C" & n).Locked = True
End If
End If
enditall:
ActiveSheet.Protect Password:="justme"
Application.EnableEvents = True
End Sub

When you enter a value in column C that cell will become locked for
editing.


Gord


Hello Gord,

The cells I want to lock are already unlocked in a protected worksheet and the above code works perfect for column C. I have a need to do the same thing on columns A thru N. How is the above code modified to do this?

Many thanks,

Jim
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re : How to lock a cell once the value is entered Andy Excel Worksheet Functions 2 June 22nd 09 08:44 PM
LOCK CELL AFTER DATA IS ENTERED MIke Excel Discussion (Misc queries) 4 October 24th 07 12:33 AM
Lock Data in Cell after entered CrimsonPlague29 Excel Discussion (Misc queries) 0 May 9th 06 11:51 AM
How do I lock a cell automatically after it has data entered. Dandy Excel Discussion (Misc queries) 0 March 30th 06 12:39 PM
how can i lock cell immediately if any value Entered? Sureshsmartdc New Users to Excel 2 August 20th 05 11:05 PM


All times are GMT +1. The time now is 10:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 ExcelBanter.
The comments are property of their posters.