View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
DogLover DogLover is offline
external usenet poster
 
Posts: 37
Default MsgBox Displays Twice

Still popping up twice. I wonder if there is another event to use rather
than the change?

"Patrick Molloy" wrote:

the change event itself chnages the value, so that raises the event
again....add the two lines indicated

Private Sub ComboBoxEndDate_Change()
If ComboBoxEndDate.Value < ComboBoxStartDate.Value Then
MsgBox ComboBoxEndDate.Value + " MUST be GREATER than Start
Date!", vbOKOnly + vbWarning, "Date Input Error"
Worksheets("RFJ").Range("N1") = 1

Application.EnableEvents = FALSE

ComboBoxEndDate.Text =
Format(CDate(Worksheets("Demo").Range("A22")), "mm/yyyy") ' Reset to Default
Orient End Date

Else
ComboBoxEndDate.Text = Format(CDate(ComboBoxEndDate.Value),
"mm/yyyy")
End If
Application.EnableEvents = TRUE
End Sub




"DogLover" wrote:

This is on the View Code attached to the EndDate Combo Box.

Private Sub ComboBoxEndDate_Change()
If ComboBoxEndDate.Value < ComboBoxStartDate.Value Then
MsgBox ComboBoxEndDate.Value + " MUST be GREATER than Start
Date!", vbOKOnly + vbWarning, "Date Input Error"
Worksheets("RFJ").Range("N1") = 1
ComboBoxEndDate.Text =
Format(CDate(Worksheets("Demo").Range("A22")), "mm/yyyy") ' Reset to Default
Orient End Date

Else
ComboBoxEndDate.Text = Format(CDate(ComboBoxEndDate.Value),
"mm/yyyy")
End If
End Sub




"Patrick Molloy" wrote:

are these on a form? can you show us the code please?

"DogLover" wrote:

I have 2 combo boxes for Dates; ComboBx1 = StartDAte, Combo2=EndDate. I
have in Combo box VB Code If EndDate<StartDate, then MsgBx dislays DAte Input
Error. Then, when I add a code to set the EndDateCombo.Value=Default Value,
the MsgBox Displays AGAIN. Does anyone know how to not have it reappear????