Send a Listbox data from one form to a Textbox from another form

0

I have managed to pass a selected data from Listbox1 of a Form1 to a Textbox1 of a Form2 with the following code:

Private Sub btnModificar_Click()
If Me.Listbox1.ListIndex < 0 Then
    MsgBox "No se ha elegido ningún registro",
Else
   Dim DATO As String, I As Integer
        DATO = Listbox1.Text
        I = Listbox1.ListIndex
        If Listbox1.ListIndex >= 0 Then
        UserForm2.Textbox1.Text = DATO
        End If

   UserForm2.Show
End If
End Sub

Sin embargo; mi problema es que cuando puse el Initialize en el UseForm2

Private Sub UserForm2_Initialize()
End Sub

I get the error "An object is required", what can I do?

    
asked by Emir Salinas 27.12.2018 в 22:34
source

0 answers