Send data from one userform to other userform?

  • Hi! I have a userform and by clicking a commanbutton i would like to show another form that has one combo and six textboxes with its data. I have done some research according to which a public variable has to be set but i do not exactly understand how to do it..Could somebody help? Thank you! This is the code i'm using to initialize and display the userform that i want to be called but i'm not sure if it matters...

  • Re: Send data from one userform to other userform?


    Can you upload your workbook please? And give us a tad better idea of what your goal is. Thanks

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Send data from one userform to other userform?


    Sorry if i was not clear. I would like to call Userform2 by clicking a commandbutton on Userform1. Userform2 has a combobox that populates six textboxes. The population should be active when Userform2 is called. And that is my problem. I can easily call Userform2 but its boxes are all empty.
    Both forms are on the same workbook in different sheets.

  • Re: Send data from one userform to other userform?


    In Userform1, in the command button click event, test for a null string in the combobox and exit the sub if a value is not selected.


    In Userform2, in the Userform_Activate event, declare a string variable and set it to the Userform1 combobox value.
    Now use the string variable in the worksheet function and populate the textboxes.

  • Re: Send data from one userform to other userform?


    In Userform1, in the command button click event, test for a null string in the combobox and exit the sub if a value is not selected.

    Code
    Option Explicit
    
    
    Private Sub CommandButton1_Click()
    
    
        If Me.ComboBox1.Value <> vbNullString Then UserForm2.Show
        
    End Sub


    In Userform2, in the Userform_Activate event, declare a string variable and set it to the Userform1 combobox value.
    Now use the string variable in the worksheet function and populate the textboxes.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!