After checking the field in userform, if the information is not added how to I shut down form

tonydeimone1942

New Member
Joined
Sep 11, 2014
Messages
14
Private Sub cmbOK_Click()
Sheet1.Activate

Range("A1").End(xlDown).Offset(1, 0).Select

If IsNumeric(txtname.Value) Then
MsgBox "You must enter a Name!"
End If

'If txtname = "" Then
'MsgBox "You must enter a Name - Idiot!"
'End If




'If txtname = "" Then
'MsgBox "You must enter a Name - Idiot!"
'Else
'Exit Sub
' End If

If IsNumeric(txtPhone.Value) Or "" Then
MsgBox "Make sure it is ten digits with no hyphens!"
Else
MsgBox "What do you not understand about a phone number only!"
End If

If txtPhone = "" Then
MsgBox "You must enter a Phone Number - Idiot!"
End If

If cboParty = "" Then
MsgBox "You must enter a Party!"
End If

If txtMuninow = "" Then
MsgBox "You must enter the Present Municipality!"
End If

If txtWardnow = "" Then
MsgBox "You must enter the Present Ward!"
End If

If txtDistrictnow = "" Then
MsgBox "You must enter the Present District!"
End If

If txtWantsMuni = "" Then
MsgBox "You must enter the Requested Municipality!"
End If

ActiveCell.Value = ActiveCell.Offset(-1, 0).Value
ActiveCell.Value = txtname.Value
ActiveCell.Offset(0, 1).Value = txtPhone.Value
ActiveCell.Offset(0, 1).NumberFormat = "[<=9999999]###-####;(###) ###-####"
ActiveCell.Offset(0, 2).Value = cboParty.Value
ActiveCell.Offset(0, 3).Value = UCase(txtMuninow.Value)
ActiveCell.Offset(0, 4).Value = txtWardnow.Value
ActiveCell.Offset(0, 5).Value = txtDistrictnow.Value
ActiveCell.Offset(0, 6).Value = UCase(txtWantsMuni.Value)
ActiveCell.Offset(0, 7).Value = txtWnatsward.Value
ActiveCell.Offset(0, 8).Value = txtWantsdistrict.Value



Unload Me

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,222,037
Messages
6,163,539
Members
451,843
Latest member
vitto

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top