ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional formatting/functions (https://www.excelbanter.com/excel-discussion-misc-queries/186146-conditional-formatting-functions.html)

[email protected]

Conditional formatting/functions
 
Hi, I'm trying to format a worksheet so that when someone enters data,
this can't be deleted or changed by the subsequent users. I still want
users to be able to enter data in other cells though. Is there a way
to do this with conditional formatting or functions?

Gord Dibben

Conditional formatting/functions
 
Only through event code which would lock each cell and protect the sheet after
entry.

Of course entering into the next cell would uprotect the sheet, lock that cell
and re-porotect the sheet.

Carry on entering, locking, protecting, unprotecting,locking...........

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

Before adding the code to the sheet module, select all cells and
FormatCellsProtection. Uncheck "Locked".

Add the code then start entering data in column B.


Gord Dibben MS Excel MVP

On Sun, 4 May 2008 20:14:53 -0700 (PDT), wrote:

Hi, I'm trying to format a worksheet so that when someone enters data,
this can't be deleted or changed by the subsequent users. I still want
users to be able to enter data in other cells though. Is there a way
to do this with conditional formatting or functions?




All times are GMT +1. The time now is 02:21 PM.

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