Testing VBA Userform

DavidPC

New Member
Joined
Apr 23, 2019
Messages
8
I'm testing a UserForm that gets user input for a number of items. When testing I click on there'd cross (top right to get back to my VBA UserForm code. This always takes me back to the "Object" view rather than the code. Is there any way to change this behaviour? Not a major problem to click on View-Code but it would be better for me to go straight to the code.
Thanks for any views.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi & welcome to MrExcel.
With the Userform code window open, place the cursor anywhere in the code & press F5
Then when you close the userform, you should be back in the code window.
 
Upvote 0
Hi & welcome to MrExcel.
With the Userform code window open, place the cursor anywhere in the code & press F5
Then when you close the userform, you should be back in the code window.

Thanks for your fast response, unfortunately this did not work for me. I positioned the cursor in me UserForm code (at the end of a line in the middle of a sub), pressed F5, the user form opened in the spreadsheet window , I clicked on the red X to close the form, the UserForm closes and in the VBA window the view is of the object (Userform design). If I then use F5 to revert to the Code View the UserForm opens again in the Spreadsheet and the VBA window changes to Object view.
 
Upvote 0
If it is relevant I have a Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) but this is empty.
 
Upvote 0
Forgot to mention, you will need to close the Object window first, then run the code.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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