TButhe
07-18-2005, 01:32 PM
I am having trouble with a message box. I have a user form that pops up if they don't make a selection on the UF and try to click OK. Why won't the message box go away? What am I doing wrong/missing? I know you all can figure this out in a flash, I'm just not getting it. :banghead: Here's my code:
Private Sub CommandButton1_Click()
Dim Answer As String
ActiveSheet.Unprotect Password:="cfs"
If BkDepType.OptionButton1.Value = True Then
Range("m2").Value = "99-999-10010-000 - General CHECKING - Clearing"
Unload Me
End If
If BkDepType.OptionButton2.Value = True Then
Range("M2").Value = "99-999-12857-000 - A/R Unapplied MEDICARE Clearing"
Unload Me
End If
If BkDepType.OptionButton3.Value = True Then
Range("M2").Value = "99-999-12857-0000 - A/R Unapplied MEDICAID Clearing"
Unload Me
End If
If BkDepType.OptionButton4.Value = True Then
Range("M2").Value = "99-999-21061-0000 - Accounts Receivable Refund"
Unload Me
End If
If BkDepType.OptionButton1.Value = False & BkDepType.OptionButton2.Value = False _
& BkDepType.OptionButton3.Value = False & BkDepType.OptionButton4.Value = False Then
Answer = MsgBox("You must choose a deposit type. Click OK to select a deposit type or click Cancel to close the form." _
, vbOKCancel, "Deposit Type!")
If Answer = vbOK Then
BkDepType.Show
ElseIf Answer = vbCancel Then
Unload Me
Unload BkDepType
Application.DisplayAlerts = wdAlertsNone
ActiveWorkbook.Close xlSaveChanges = False
Application.DisplayAlerts = wdAlertsAll
Exit Sub
End If
End If
End Sub
Private Sub CommandButton1_Click()
Dim Answer As String
ActiveSheet.Unprotect Password:="cfs"
If BkDepType.OptionButton1.Value = True Then
Range("m2").Value = "99-999-10010-000 - General CHECKING - Clearing"
Unload Me
End If
If BkDepType.OptionButton2.Value = True Then
Range("M2").Value = "99-999-12857-000 - A/R Unapplied MEDICARE Clearing"
Unload Me
End If
If BkDepType.OptionButton3.Value = True Then
Range("M2").Value = "99-999-12857-0000 - A/R Unapplied MEDICAID Clearing"
Unload Me
End If
If BkDepType.OptionButton4.Value = True Then
Range("M2").Value = "99-999-21061-0000 - Accounts Receivable Refund"
Unload Me
End If
If BkDepType.OptionButton1.Value = False & BkDepType.OptionButton2.Value = False _
& BkDepType.OptionButton3.Value = False & BkDepType.OptionButton4.Value = False Then
Answer = MsgBox("You must choose a deposit type. Click OK to select a deposit type or click Cancel to close the form." _
, vbOKCancel, "Deposit Type!")
If Answer = vbOK Then
BkDepType.Show
ElseIf Answer = vbCancel Then
Unload Me
Unload BkDepType
Application.DisplayAlerts = wdAlertsNone
ActiveWorkbook.Close xlSaveChanges = False
Application.DisplayAlerts = wdAlertsAll
Exit Sub
End If
End If
End Sub