ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,199
- Office Version
- 2007
- Platform
- Windows
Morning.
I am using the code supplied below.
The issue i believe is with the code in Red.
The message concenred is in BLUE
This is used on a userform where making a selection from a ComboBox would then show two different selectable options BUT the message shown in BLUE below in shown for BOTH & ideally would like two different messages.
Example
If i select "TEST 1" from the ComboBox & i then see OptionButton1 & OptionButton3 appear.
If i now dont select either & try to continue i see the message shown in RED below.
If i select "TEST 2" from the ComboBox & i then see OptionButton2 & OptionButton4 appear.
If i now dont select either & try to continue i see the message shown in RED below.
So the same message shown for both cases, Ideally would be nice to see message YOU DID NOT SELECT EITHER OPTION 1 OR 3 & another message like YOU DID NOT SELECT EITHER OPTION 2 OR 4
So each have there own message
I am using the code supplied below.
The issue i believe is with the code in Red.
The message concenred is in BLUE
This is used on a userform where making a selection from a ComboBox would then show two different selectable options BUT the message shown in BLUE below in shown for BOTH & ideally would like two different messages.
Example
If i select "TEST 1" from the ComboBox & i then see OptionButton1 & OptionButton3 appear.
If i now dont select either & try to continue i see the message shown in RED below.
If i select "TEST 2" from the ComboBox & i then see OptionButton2 & OptionButton4 appear.
If i now dont select either & try to continue i see the message shown in RED below.
So the same message shown for both cases, Ideally would be nice to see message YOU DID NOT SELECT EITHER OPTION 1 OR 3 & another message like YOU DID NOT SELECT EITHER OPTION 2 OR 4
So each have there own message
Rich (BB code):
Private Sub TransferButton_Click()
With ThisWorkbook.Worksheets("RANGER")
Dim i As Long
Dim x As Long
Dim ctrl As Control
Dim lastrow As Long
Cancel = 0
If TextBox1.Text = "" Then
Cancel = 1
MsgBox "NO CUSTOMER'S NAME WAS ENTERED", vbCritical, "RANGER FIELD EMPTY MESSAGE"
TextBox1.SetFocus
ElseIf TextBox2.Text = "" Then
Cancel = 1
MsgBox "YOU DIDNT ENTER THE VIN", vbCritical, "RANGER FIELD EMPTY MESSAGE"
TextBox2.SetFocus
ElseIf ComboBox1.Text = "" Then
Cancel = 1
MsgBox "NO YEAR WAS SELECTED", vbCritical, "RANGER FIELD EMPTY MESSAGE"
ComboBox1.SetFocus
ElseIf ComboBox2.Text = "" Then
Cancel = 1
MsgBox "REMOTE TYPE WAS NOT SELECTED", vbCritical, "RANGER FIELD EMPTY MESSAGE"
ComboBox2.SetFocus
End If
If Cancel = 1 Then
Exit Sub
End If
x = 0
For i = 1 To 4
If Me.Controls("OptionButton" & i) = True Then
x = x + 1
Opt = i
End If
Next
If x = 0 Then
MsgBox "YOU DIDNT SELECT AN OPTION BUTTON", vbCritical, "RANGER OPTION BUTTON EMPTY MESSAGE"
Exit Sub
End If
Rows("5:5").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B5:I5").Borders.LineStyle = xlContinuous
Range("B5:I5").Borders.Weight = xlThin
Range("B5:I5").Interior.ColorIndex = 6
Range("C5:I5").HorizontalAlignment = xlCenter
Sheets("RANGER").Range("B5").Select
Cancel = 0
If Cancel = 1 Then
Exit Sub
End If
With ThisWorkbook.Worksheets("RANGER")
.Range("B5").Value = TextBox1.Text
.Range("D5").Value = TextBox2.Text
.Range("F5").Value = TextBox3.Text
.Range("G5").Value = TextBox4.Text
.Range("C5").Value = ComboBox1.Text
.Range("H5").Value = ComboBox2.Text
.Range("E5").Value = Me.Controls("OptionButton" & Opt).Caption
End With
If ComboBox2.Value = "ORIGINAL 2B" Then
Unload RangerFormRemote
RangerPcbNumber.Show
Else
With .Range("I5")
.Value = "N/A"
.Font.Size = 14
.Font.Name = "Calibri"
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlVAlignCenter
Unload RangerFormRemote
End With
With Sheets("RANGER")
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 5).End(xlUp).Row
.Range("A4:I" & x).Sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess
MsgBox "DATABASE UPDATED SUCCESSFULLY", vbInformation, "SUCCESSFUL MESSAGE"
End With
Application.ScreenUpdating = True
Range("B6").Select
Range("B5").Select
End If
End With
End Sub