Home > Excel Tutorial > Opening New Userform According To The Clicked Listbox İtem

Opening New Userform According To The Clicked Listbox İtem

Populating Text Boxes Based On The Listbox Clicked Item

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

When item of listbox clicked,another userform opens. The opened userform’s text boxes are populated based on listbox clicked item value  :

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

UserForm2.Show

End Sub

….

Populating Text Boxes Based On The Listbox Clicked Item

Download Template and Use It

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: