Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,227
- Office Version
- 2010
- Platform
- Windows
hi just wondering if it is possible to sync 2 listboxes together in code, as i have 14 columns and listboxes only can list 10 please see below the code i have at moment
VBA Code:
Private Sub ListBox1_AfterUpdate()
Me.TextBox1.Value = Me.ListBox1.Column(0)
Me.TextBox2.Value = Me.ListBox1.Column(1)
Me.TextBox3.Value = Me.ListBox1.Column(2)
Me.TextBox4.Value = Me.ListBox1.Column(3)
Me.TextBox5.Value = Me.ListBox1.Column(4)
Me.TextBox6.Value = Me.ListBox1.Column(5)
Me.TextBox7.Value = Me.ListBox1.Column(6)
End Sub
Code:
Private Sub ListBox2_AfterUpdate()
Me.TextBox8.Value = Me.ListBox2.Column(0)
Me.TextBox9.Value = Me.ListBox2.Column(1)
Me.TextBox10.Value = Me.ListBox2.Column(2)
Me.TextBox11.Value = Me.ListBox2.Column(3)
Me.TextBox12.Value = Me.ListBox2.Column(4)
Me.TextBox13.Value = Me.ListBox2.Column(5)
Me.TextBox14.Value = Me.ListBox2.Column(6)
End Sub