Tuesday, August 16, 2016

Loading New Userform According To The Clicked Listbox Item

         We used a template that we did earlier (Filtering On Listbox And Copying Filtered Data) in this study.

When any item of listbox clicked,another userform opens. The opened userform's text boxes are populated based on listbox clicked item value .Vba codes that supply the loading of the userform and the filling of the text boxes when double-clicking on the listbox :

Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Load UserForm2
UserForm2.TextBox1 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 0)
UserForm2.TextBox2 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 1)
UserForm2.TextBox3 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 2)
UserForm2.TextBox4 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 3)
UserForm2.TextBox5 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 4)
UserForm2.TextBox6 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 5)
UserForm2.TextBox7 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 6)
UserForm2.TextBox8 = VBA.Format(UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 7), "#,##.00")
UserForm2.TextBox9 = VBA.Format(UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 8), "dd.mm.yyyy")
UserForm2.TextBox10 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 0)
Unload UserForm1
End Sub


  1. please suggest how to download the file

    1. - Click http://adf.ly/1dDv2T
      - The "Skip Ad" button appears in the upper right corner.You will be redirected to "google.com/drive" when you press this button.
      - On the top of page(google.com/drive),there is an arrow pointing down.Click it and download file.

  2. any idea how to download the file