Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking a cell after input
I have a sheet that is protected except for one column that I need to put
sales receipts into. Is there a way for me to maybe do a conditional formatting and have the cell locked after it's contents are 0.00? I am using WinXP and Excel 2002 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking a cell after input
Right click the sheet tab, select View Code and paste this procedure into the
sheet code module: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value 0 Then Me.Unprotect Target.Locked = True Me.Protect End If End Sub This will work if the sheet protection was set without a password. Otherwise try: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value 0 Then Me.Unprotect Password:="mypassword" Target.Locked = True Me.Protect Password:="mypassword" End If End Sub Hope this helps Rowan "bethg7" wrote: I have a sheet that is protected except for one column that I need to put sales receipts into. Is there a way for me to maybe do a conditional formatting and have the cell locked after it's contents are 0.00? I am using WinXP and Excel 2002 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking a cell after input
I just tried it and it worked!! Thanks so much. This will be a real big
help to me to keep me from changing what I have already entered. "Rowan" wrote: Right click the sheet tab, select View Code and paste this procedure into the sheet code module: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value 0 Then Me.Unprotect Target.Locked = True Me.Protect End If End Sub This will work if the sheet protection was set without a password. Otherwise try: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value 0 Then Me.Unprotect Password:="mypassword" Target.Locked = True Me.Protect Password:="mypassword" End If End Sub Hope this helps Rowan "bethg7" wrote: I have a sheet that is protected except for one column that I need to put sales receipts into. Is there a way for me to maybe do a conditional formatting and have the cell locked after it's contents are 0.00? I am using WinXP and Excel 2002 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Input cell should display a percentage of input value in the cell | Excel Discussion (Misc queries) | |||
How to input pictures automatically based on cell input? | Excel Worksheet Functions | |||
run macro with input msg based on cell input | Excel Discussion (Misc queries) | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
Locking The Cells with Input At The Time of Saving The File | Excel Discussion (Misc queries) |