PDA

View Full Version : How to Lock or Unlock row basis previous cell input?



Rajesh Kr Joshi
07-25-2012, 12:10 AM
Hi,

I have a daily task trackers wherein the employees inputs their daily task hours, but i wants that they should not be able to input the data in row 3 if B3 is blank. Also is it possible the code should through a message box saying "Description Is Blank".
Workbook attached.


305

Thanks in advance.
Rajesh

Rick Rothstein
07-25-2012, 06:37 AM
Give this event code a try...


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("C:K")) Is Nothing Then
If Cells(Target.Row, "B") = "" And Target.Value <> "" Then
MsgBox "The description is blank... you must have a description before you can fill in any tasks!"
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End If
End Sub


HOW TO INSTALL Event Code
------------------------------------
If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself.

Rajesh Kr Joshi
07-25-2012, 02:40 PM
Simply AWESOME.

Thanks a lot Rick :)