epardo87
Board Regular
- Joined
- Feb 24, 2015
- Messages
- 56
Hello, I have the codes below and I want that none of them are transferred if both are not filled. Currently if any of them is empty a window pops up saying "fill everything please" but still transferring data even if they're not all filled (if I fill only the second one and hit Ok button, the data of second one is transferred and the window also pops up):
Appreciate any help!
Appreciate any help!
Code:
'Transfer information
Dim bControlEmpty As Boolean
bControlEmpty = False
If Len(UserTextBox.Value) > 0 Then
Cells(emptyRow, 1).Value = UserTextBox.Value
Else
bControlEmpty = True
End If
If Len(TravelerTextBox.Value) > 0 Then
Cells(emptyRow, 2).Value = TravelerTextBox.Value
Else
bControlEmpty = True
End If
If bControlEmpty Then
MissingUserForm.Show
Unload Me
Else
Cells(emptyRow, 5).Value = Date
Unload Me
End If