Userform question

Alpacino

Well-known Member
Joined
Mar 16, 2011
Messages
511
I have a userform with ok and cancel buttons as usual for the OK button I would like to put a msgbox in after macro1 saying "training successfully updated" and closes userform and if Cancel is pressed msgbox "goodbye" and closes userform.
Where do input the code???
I have tried it but it doesn't work if I press Cancel it's pops up with both msgbox messages "goodbye" and "training successfully updated"
Anyone help please
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try this in your userform:
Code:
Private Sub CancelButton_Click()
'Your Code here'
MsgBox "Goodbye"
Unload Me
End Sub

Private Sub OKButton_Click()
'Your Code Here'
MsgBox "Training successfully completed"
Unload Me
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,589
Messages
6,179,744
Members
452,940
Latest member
rootytrip

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