Skips the macro Call

HunterN

Active Member
Joined
Mar 19, 2002
Messages
479
I have a macro that asks the user is they want
to enter another project into the Userform
input boxes. If the user selects 'Yes' then it is suppose to Call a macro that will clear the fields. My problem is sometimes the macro just skips over the Call. I can even watch it in debug, where CheckMsg will = 6 and it should go outside the If statement and excute the next command but it doesn't. Any answers to this one?

Below is the code in the program:
Sub Add()
.
.
CheckMsg = MsgBox("Do you want to Enter another Project?", vbYesNo + vbQuestion)
If CheckMsg = vbNo Then
Call Clearboxes

Unload Frm2_Add
Frm1_Main.Show
Exit Sub
End If

Call Clearboxes
end sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Barrie Davidson

MrExcel MVP
Joined
Feb 10, 2002
Messages
2,330
On 2002-10-01 11:57, HunterN wrote:
I have a macro that asks the user is they want
to enter another project into the Userform
input boxes. If the user selects 'Yes' then it is suppose to Call a macro that will clear the fields. My problem is sometimes the macro just skips over the Call. I can even watch it in debug, where CheckMsg will = 6 and it should go outside the If statement and excute the next command but it doesn't. Any answers to this one?

Below is the code in the program:
Sub Add()
.
.
CheckMsg = MsgBox("Do you want to Enter another Project?", vbYesNo + vbQuestion)
If CheckMsg = vbNo Then
Call Clearboxes

Unload Frm2_Add
Frm1_Main.Show
Exit Sub
End If

Call Clearboxes
end sub

Change your code from:

CheckMsg = MsgBox("Do you want to Enter another Project?", vbYesNo + vbQuestion)
If CheckMsg = vbNo Then
Call Clearboxes

to:

CheckMsg = MsgBox("Do you want to Enter another Project?", vbYesNo + vbQuestion)
If CheckMsg = vbNo Then Call Clearboxes


Regards,
 

Forum statistics

Threads
1,144,275
Messages
5,723,449
Members
422,497
Latest member
dougy99

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
Top