MUSASHI
11-04-2004, 09:03 AM
Im trying to stop the cells in worksheet being allowed to be filled if an employee number is not entered, which is inputted in tbEmpNumber. I have its default value set to "Required!". How can I make sure a value other than the default "Required!" is entered before it places the other data/any data in it.
Hope that added up...
Private Sub btn_EmpOK_Click()
Dim LastRow As Long
LastRow = Worksheets("Employee").Range("A65536").End(xlUp).Row + 1
Cells(LastRow, 1).Value = tb_LastName.Value
Cells(LastRow, 2).Value = tbFirstName.Value
Cells(LastRow, 4).Value = cb_EmpPosition.Value
Cells(LastRow, 5).Value = tbAddress.Value
Cells(LastRow, 6).Value = tbCity.Value
Cells(LastRow, 7).Value = tbState.Value
Cells(LastRow, 8).Value = tbZip.Value
Cells(LastRow, 9).Value = tbPhone1.Value
Cells(LastRow, 10).Value = tbPhone2.Value
Cells(LastRow, 11).Value = DateSerial(SpinButton1.Value, SpinButton2.Value, SpinButton3.Value)
Cells(LastRow, 12).Value = tbSocial.Value
Cells(LastRow, 3).Value = tbEmpNumber.Value
Cells(LastRow, 13).Value = DateSerial(SpBtn_Year.Value, SpBtn_Month.Value, SpBtn_Day.Value)
If opbtn_NewHire.Value Then
Cells(LastRow, 14).Value = opbtn_NewHire.Caption
Else
Cells(LastRow, 13).Value = opbtn_ReHire.Caption
End If
Range("A3:A" & LastRow).Name = "EmpList"
'make sure employee number is entered
Unload Me
End Sub
Thanks Mus
Hope that added up...
Private Sub btn_EmpOK_Click()
Dim LastRow As Long
LastRow = Worksheets("Employee").Range("A65536").End(xlUp).Row + 1
Cells(LastRow, 1).Value = tb_LastName.Value
Cells(LastRow, 2).Value = tbFirstName.Value
Cells(LastRow, 4).Value = cb_EmpPosition.Value
Cells(LastRow, 5).Value = tbAddress.Value
Cells(LastRow, 6).Value = tbCity.Value
Cells(LastRow, 7).Value = tbState.Value
Cells(LastRow, 8).Value = tbZip.Value
Cells(LastRow, 9).Value = tbPhone1.Value
Cells(LastRow, 10).Value = tbPhone2.Value
Cells(LastRow, 11).Value = DateSerial(SpinButton1.Value, SpinButton2.Value, SpinButton3.Value)
Cells(LastRow, 12).Value = tbSocial.Value
Cells(LastRow, 3).Value = tbEmpNumber.Value
Cells(LastRow, 13).Value = DateSerial(SpBtn_Year.Value, SpBtn_Month.Value, SpBtn_Day.Value)
If opbtn_NewHire.Value Then
Cells(LastRow, 14).Value = opbtn_NewHire.Caption
Else
Cells(LastRow, 13).Value = opbtn_ReHire.Caption
End If
Range("A3:A" & LastRow).Name = "EmpList"
'make sure employee number is entered
Unload Me
End Sub
Thanks Mus