Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
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
Input cell should display a percentage of input value in the cell Sherees Excel Discussion (Misc queries) 0 December 16th 09 10:25 PM
How to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
Locking The Cells with Input At The Time of Saving The File In Calif Excel Discussion (Misc queries) 2 September 10th 05 05:33 PM


All times are GMT +1. The time now is 06:25 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"