Data Validation Question

  • Thread starter Thread starter Kenny
  • Start date Start date
K

Kenny

I am trying to do the following:
(this is a time ticket with time codes and hours)

In cell A1 you enter the time code (reg,vac or sic) and then in A2 thru A8
you enter hours worked.
If you enter a number in cells A2 thru A8 and have not entered a proper time
code, then the "Error Alert" message will pop up prompting for a time code.

Is this possible?
Thanks in advance
Kenny
 
Put the following in the worksheet's code module.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim str1 As String

If Target.Column = 1 And Target.Row > 1 And _
Target.Row < 9 And Range("A1") = "" Then
str1 = InputBox("Enter a time code (reg, vac or sic).")
Range("A1") = str1
End If
End Sub

HTH,
Merjet
 
Back
Top