Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 1
Default auto locking cells after new entry/edit

Is it possible to set excel to automatically lock a cell after entering data
or after editing?
  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 22,906
Default auto locking cells after new entry/edit

Yes

Using event code.

Assuming column B cells are unlocked and the sheet is protected with
password "justme", as you enter data in column B, the cell will become
locked.

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

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste the code into that module.

I'm sure your needs are not exactly as per sample above.

If you provide more detail perhaps code could be tailored.


Gord Dibben MS Excel MVP

On Mon, 29 Sep 2008 00:56:00 -0700, patbayns
wrote:

Is it possible to set excel to automatically lock a cell after entering data
or after editing?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking a cell after data entry (Excel 2003) jeffparker98 Excel Discussion (Misc queries) 0 September 19th 08 07:38 PM
how to have auto calc cells be blank unless entry made miss sass Excel Worksheet Functions 2 July 13th 08 09:41 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Want a number of cells to be auto completed based on entry in one. matt ashley Excel Worksheet Functions 1 April 14th 05 10:07 PM


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

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

About Us

"It's about Microsoft Excel"