Hi i hope someone can help me. i have created a form with around six fields for entry. Once these are completed you click a button and it updates one of the excel sheets & generates a message to say please complete further boxes (that are then visible to you on the excel page) if the person tries to click the button to continue without having entered data in all boxes or if the data in one particular box does not match a set criteria an error message comes up and takes them back to the form.
The problem i have is that if either of these 2 error message boxes has been triggered the message about completing the excel fields comes up an additional time for each error triggered. so if you have triggered error box twice you get 3 messages to continue instead of just the once. I guess it is looping round somewhere but have no idea how to fix it
i have shown my code below (apologies if it is a bit long - i am new to vba!)
thanks
Private Sub cmdeurope_Click()
With projectquote
If .txtname = "" Or .txtdate = "" Or .cboname = "" Or .Cbotype = "" Or .cbocountry = "" Or .cbocurrency = "" Then
MsgBox ("Not all boxes completed")
End If
If .cbocountry <> "Europe Only" Then
MsgBox ("Selected Option does not match country code")
projectquote.Hide
projectquote.Show
End If
Sheets("europe").Select
Range("E4") = .txtname
Range("E6") = .txtdate
Range("E8") = .cboname
Range("E10") = .Cbotype
Range("E12") = .cbocountry
Range("E14") = .cbocurrency
End With
projectquote.Hide
Sheets("europe").Select
answer = MsgBox("Please complete Project Duration & Complexity Boxes for European Resource")
Sheets("europe").Select
Range("b17").Select
End Sub
The problem i have is that if either of these 2 error message boxes has been triggered the message about completing the excel fields comes up an additional time for each error triggered. so if you have triggered error box twice you get 3 messages to continue instead of just the once. I guess it is looping round somewhere but have no idea how to fix it
i have shown my code below (apologies if it is a bit long - i am new to vba!)
thanks
Private Sub cmdeurope_Click()
With projectquote
If .txtname = "" Or .txtdate = "" Or .cboname = "" Or .Cbotype = "" Or .cbocountry = "" Or .cbocurrency = "" Then
MsgBox ("Not all boxes completed")
End If
If .cbocountry <> "Europe Only" Then
MsgBox ("Selected Option does not match country code")
projectquote.Hide
projectquote.Show
End If
Sheets("europe").Select
Range("E4") = .txtname
Range("E6") = .txtdate
Range("E8") = .cboname
Range("E10") = .Cbotype
Range("E12") = .cbocountry
Range("E14") = .cbocurrency
End With
projectquote.Hide
Sheets("europe").Select
answer = MsgBox("Please complete Project Duration & Complexity Boxes for European Resource")
Sheets("europe").Select
Range("b17").Select
End Sub