-
Solved: Another Problem
I have another one guys.
Please see the following code. Everything I want to do works flawlessly, except for 1 thing. If I pick from combo box 2 and leave combo box 3 empty, I get my msgbox " You must enter a material" upon hitting the OK button. The problem is, the code doesn't stop and let me choose a material. The next msgbox opens and says " Would you like to price another gasket?"
Question is, how to I get the code to stop as soon as it reaches this error and wait for proper input before proceeding completely?
Thanks Gents,
[vba]Public Sub OkButton_Click()
If ComboBox2.Text = "" Then MsgBox " You Must Enter A Material"
If ComboBox3.Text = "" Then MsgBox " You Must Enter A Thickness"
On Error Resume Next
MsgBox "Total Sell Cost of Gasket is $" & Range("c25")
If MsgBox("Would you like to price another gasket?", vbYesNo) = vbYes Then
Call UserForm1.Show
Else
ActiveWorkbook.Close savechanges:=False
End If
End Sub[/vba]
-
just have to exit the sub...
[vba]Public Sub OkButton_Click()
If ComboBox2.Text = "" Then
MsgBox " You Must Enter A Material"
Exit Sub
End If
If ComboBox3.Text = "" Then
MsgBox " You Must Enter A Thickness"
Exit Sub
End If
On Error Resume Next
MsgBox "Total Sell Cost of Gasket is $" & Range("c25")
If MsgBox("Would you like to price another gasket?", vbYesNo) = vbYes Then
Call UserForm1.Show
Else
ActiveWorkbook.Close savechanges:=False
End If
End Sub[/vba]
-
Thank you so much.....seems to be so much easier than what I've been trying lol. Thanks again,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules