Checking a userform that is not visible yet RRS feed

  • Question

  • I have a userform where the user can make some choices. If the user wants to be more specific he/she can press a button and a second userform is shown that offers more detailed choices. The second userform is thus optional and if the user whishes to skip that step he/she should be able to do so. My problem is that the (default)settings in the second userform is necessary for the rest of the macro.

    now i have it all on the same userform but that creates a problem because there are so many checkboxes etc. that it becomes hard to use. I thus want to use the setup described above. my problem is that I need to keep everything variable eg now i count the number of checkboxes in the userform and use that value later on.

    question 1)

    is it possible to eg count the number of checkboxes on a userform that has not yet been displayed? I thought perhaps that you could initialize it but not show it...

    question 2)

    if the answer to question 1 is no, is there any other way of going around the problem? I know i can save the default settings as variables but i need to keep it flexible ie count the number of checkboxes.


    Here is some code that might be informative. I start the userform in a worksheet:

    Public Sub startKnapp_Click()
    End Sub

    In the code for userForm1:


    Private Sub UserForm1_Initialize()
    Call UserForm2_Initialize

    Me.ScrollBars = fmScrollBarsBoth

    Me.ScrollHeight = Me.Height        
    Me.Height = Me.Height / 2          

    End Sub

    here is code for the second userform:

    Private Sub UserForm2_Initialize()

    end sub

    now this does not work but is there any way of doing it? any help is very much appreciated!Tahnks in advance!

    Wednesday, August 2, 2006 1:09 PM


  • Hello,

    You can reference controls in Userform1 without having it visible if you use the statement

    "Load Userform1" rather than ""

    By loading it, it is in memory and everything is availlable but the form remains hidden


    Wednesday, August 2, 2006 5:49 PM