teebird
Technical User
- Dec 11, 2001
- 239
How can I stop a User from leaving a cell (in spreadsheet) empty. I have tried Data Validation but the user needs to click in the cell for this to work.
Is there something like when the cell loses focus, an error message will pop up saying that the cell is empty and must have a value.
I have tried this If statement but it is not working.
ws.Cells(orow, "A").Value = Range("Input!B5")
If Len(Range("B5").Value) = 0 Then
MsgBox "Please add the Patient's HRN!", vbOKOnly, "HRN Error"
Range("B5").Select
End If
Exit Sub
ws.Cells(orow, "B").Value = Range("Input!B6")
If Len(Range("B6").Value) = 0 Then
MsgBox "Please add the Patient's Name!", vbOKOnly, "Name Error"
Range("B6").Select
End If
Exit Sub
Thanks for any help.
Is there something like when the cell loses focus, an error message will pop up saying that the cell is empty and must have a value.
I have tried this If statement but it is not working.
ws.Cells(orow, "A").Value = Range("Input!B5")
If Len(Range("B5").Value) = 0 Then
MsgBox "Please add the Patient's HRN!", vbOKOnly, "HRN Error"
Range("B5").Select
End If
Exit Sub
ws.Cells(orow, "B").Value = Range("Input!B6")
If Len(Range("B6").Value) = 0 Then
MsgBox "Please add the Patient's Name!", vbOKOnly, "Name Error"
Range("B6").Select
End If
Exit Sub
Thanks for any help.