Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Conditional locking of a cell

Does someone know a way to prevent a user from entering data into a cell
unless there is something first entered into different cell. Here is an
example of what I am trying to do.

=IF(A1="",disable data entry in D1,enable data entry in D1)
=IF(A1="",D1="")

The application is a time sheet. I want to prevent a person from entering
their hours until a billing code is first entered. In addition, if the
billing code is deleted then I want to delete the hours booked against it as
well.

Thanks for any tips

Best regards
GordL
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Conditional locking of a cell

right click on sheet tab, view code, paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing And _
Intersect(Target, Range("D1")) Is Nothing Then Exit Sub

If Range("A1").Value = "" Then
Application.EnableEvents = False
Range("D1").Value = ""
'Include a message, if desired
MsgBox "A1 must have a value", vbOKOnly
Application.EnableEvents = True
End If

End Sub


'Note that users can still input data into D1, but it is immediately deleted.
'While it might be possible to prevent this via some formula in data
validation
'you needed to use VB anyway to clear D1, so I combined the two features
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"GordL" wrote:

Does someone know a way to prevent a user from entering data into a cell
unless there is something first entered into different cell. Here is an
example of what I am trying to do.

=IF(A1="",disable data entry in D1,enable data entry in D1)
=IF(A1="",D1="")

The application is a time sheet. I want to prevent a person from entering
their hours until a billing code is first entered. In addition, if the
billing code is deleted then I want to delete the hours booked against it as
well.

Thanks for any tips

Best regards
GordL

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Conditional locking of a cell

I would be inclined to use a custom data validation for that. In Cell D1 select
Data -Validation - Custom | =A1 < ""
and uncheck Ignore Blanks.
Change the error message to something that indactes they need to enter a code
Choose Ok.
--
HTH...

Jim Thomlinson


"GordL" wrote:

Does someone know a way to prevent a user from entering data into a cell
unless there is something first entered into different cell. Here is an
example of what I am trying to do.

=IF(A1="",disable data entry in D1,enable data entry in D1)
=IF(A1="",D1="")

The application is a time sheet. I want to prevent a person from entering
their hours until a billing code is first entered. In addition, if the
billing code is deleted then I want to delete the hours booked against it as
well.

Thanks for any tips

Best regards
GordL

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
Conditional Locking Gnani Excel Worksheet Functions 0 June 10th 08 04:44 AM
Conditional Locking of Cells-Excel 2003 MikeTVC Excel Worksheet Functions 1 November 16th 07 07:13 PM
Conditional Locking of Cells MikeTVC Excel Worksheet Functions 5 November 14th 07 09:03 PM
Conditional locking of cells for individual rows mthatt Excel Discussion (Misc queries) 4 April 2nd 07 12:57 PM
Conditional Cell Locking Bear3164 Excel Worksheet Functions 2 January 23rd 07 12:49 AM


All times are GMT +1. The time now is 09:48 PM.

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"