kimberly090
Board Regular
- Joined
- May 22, 2014
- Messages
- 99
Hi,
I wish to display a different message box when it meet the following requirement:
1. When textbox8 value less than 3, message box will show textbox8 is out of range, do user want to continue store the data, if user hit yes, then will continue store the data but if user select no, will ask user to re-enter textbox8 value then only store data.
2. When textbox8 value is between 3 to 3.2, message box will show textbox8 is between 3 to 3.2, please be aware, and show a OK button for user to click and store the data.
I have try to add another message box inside but it will only check the first condition.
I wish to display a different message box when it meet the following requirement:
1. When textbox8 value less than 3, message box will show textbox8 is out of range, do user want to continue store the data, if user hit yes, then will continue store the data but if user select no, will ask user to re-enter textbox8 value then only store data.
2. When textbox8 value is between 3 to 3.2, message box will show textbox8 is between 3 to 3.2, please be aware, and show a OK button for user to click and store the data.
I have try to add another message box inside but it will only check the first condition.
Code:
Sheets("Overall").Activate
With Me
If Len(.ComboBox5.Value) * Len(.TextBox4.Value) * Len(.TextBox5.Value) * Len(.TextBox6.Value) * Len(.ComboBox6.Value) * Len(.TextBox7.Value) * Len(.TextBox8.Value) = 0 Then
MsgBox "Please Complete All Fields Before Submit"
Else
If CSng(.TextBox8.Text) < 3 Then
If MsgBox("TextBox8 less than 3.0" & vbLf & vbLf & _
"Do you wish to continue?", vbYesNo, "Exceeds") = vbNo Then
MsgBox "user to re-type the value in TextBox8.", vbInformation, "Title"
TextBox8.SetFocus
Else
If CSng(.TextBox8.Text) >= 3 And CSng(.TextBox8.Text) <= 3.2 Then
MsgBox "TextBox8 between 3 to 3.2, Aware!!!", , "Alert"
Exit Sub
End If
End If
End If
End If
eRow = Sheet4.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(eRow, 11).Value = ComboBox5.Text
Cells(eRow, 7).Value = TextBox4.Text
Cells(eRow, 8).Value = TextBox5.Text
Cells(eRow, 14).Value = TextBox6.Text
Cells(eRow, 16).Value = ComboBox6.Text
Cells(eRow, 12).Value = TextBox7.Text
Cells(eRow, 13).Value = TextBox8.Text
Cells(eRow, 19).Value = TextBox9.Text
End If
End With
End Sub