ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA If Statements (https://www.excelbanter.com/excel-programming/350500-vba-if-statements.html)

Runner77[_2_]

VBA If Statements
 

Hello,

The following Code which give me a message to either click Yes or N
How do i Get it to Close UserForm4 when I click on No

Regards
Runner77

Private Sub cmbexit_Click()
MsgAdd = MsgBox("Would you like to place another order?", vbYesNo
"Thank You for Your Order?")
If MsgAdd = vbYes Then UserForm4.Hide
UserForm1.Show
DoEvents
End Su

--
Runner7
-----------------------------------------------------------------------
Runner77's Profile: http://www.excelforum.com/member.php...fo&userid=3038
View this thread: http://www.excelforum.com/showthread.php?threadid=50156


Mark Lincoln

VBA If Statements
 
It appears to me that you want to close UserForm 4 in either event.
Therefo

Private Sub cmbexit_Click()
MsgAdd = MsgBox("Would you like to place another order?", vbYesNo,
"Thank You for Your Order?")
UserForm4.Hide
If MsgAdd = vbYes Then UserForm1.Show
DoEvents
End Sub

Does this work for you?


Runner77[_3_]

VBA If Statements
 

Thanks Mark,

The Code Works

Regards
Runner7

--
Runner7
-----------------------------------------------------------------------
Runner77's Profile: http://www.excelforum.com/member.php...fo&userid=3038
View this thread: http://www.excelforum.com/showthread.php?threadid=50156



All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com