how would I code this? thank you
how would I code this? thank you
![]()
Please Login or Register to view this content.
thanks for the reply! but the form can also me opened manually so I can have it automatically click that button.. is the a way to have this done without having it do this when the form Initializes?
Hi Jenkins27,
See the attached file and the code below which is included in the file. Please note that OptionButtons are usually placed in a Group, to allow more than one set of OptionButtons on a UserForm.
There is more than one way to accomplish what you want.
Please note that in both cases the CommandButton Event Handler gets activated before the UserForm is displayed.
There are two ways to display a UserForm, Modal (which locks out all Excel Resources) and nonModal or Modeless (which allows Excel resources to be accessed).
When a UserForm is loaded as Modal, macro execution is paused at the line that loads the UserForm. Execution continues when the '.Hide' or the 'Unload' command is executed. That is why the UserForm commands are before the .Show command in Sub DisplayUserForm2NormalRuntimeUsage().
When a UserForm is loaded as NonModal, macro execution continues after the .Show command.
The commands for each are displayed here:
![]()
Please Login or Register to view this content.
------------------------
In the first case (UserForm1), the heavy lifting is done by UserForm_Initialize() which is automatically called when the UsefForm is loaded (.show) command.
UserForm1 module code:
Ordinary Module code:![]()
Please Login or Register to view this content.
------------------------![]()
Please Login or Register to view this content.
In the second case (UserForm2), the ordinary module code sets the values before the UserForm is loaded.
UserForm2 module code:
Ordinary Module code:![]()
Please Login or Register to view this content.
Lewis![]()
Please Login or Register to view this content.
thank you!! that's great!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks