intializing a user form in vba

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I created simple form (2 text boxes+ 3 cmd buttons). I wrote a code to show the form (no problem) an wrote another sub to initialized the form (not sure how important is that but I read somewhere that I need to do that). I put both sub in the same Module. I read that the UserForm_Intialize() should be called automatically after finishing sub callingform() but that did not happen to me. I stepped over the code but it will not move beyond End sub of Callingform() . Any help would be very much appreciated. Thanks


Sub callingform()
myform.show
End Sub

Sub UserForm_Intialize()
first.value="john"
second.value="smith"
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Do you have a userform called myform?
And is the
Code:
Sub UserForm_Intialize()
in the Userform module?
 
Upvote 0
All userform code must be in the userform module.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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