Hello. I am new to this forumn and excel vba but having a great time learning
I am trying to create a Userform with inputs populated to a Listbox. My "add new record" populates fields to the Listbox/database and 1st few Userform fields populate when clicking a Listbox record but not all.
Below is the code I am using to initialize and Listbox click. All Userform fields populate when clicking a Listbox record but State.Value and any after do not populate and I get a
"Could not get column property. invalid property argument"
Private Sub ListBox1_click()
Client.Value = ListBox1.Column(0)
Officer.Value = ListBox1.Column(1)
Documentor.Value = ListBox1.Column(2)
Revenue.Value = ListBox1.Column(3)
Naics.Value = ListBox1.Column(4)
Contact.Value = ListBox1.Column(5)
Title.Value = ListBox1.Column(6)
Telephone.Value = ListBox1.Column(7)
Address.Value = ListBox1.Column(8)
City.Value = ListBox1.Column(9)
State.Value=Listbox1.column(10) <State.value and any after do not populate>
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
Dim X As Integer
On Error Resume Next
For i = 0 To 12
Me.ListBox1.AddItem
For X = 1 To Sheet4.Range("A" & Rows.Count).End(xlUp).Row
Me.ListBox1.List(i - 1, X - 1) = Sheet4.Cells(i, X)
Next X
Next i
End Sub
Thanks in advance
Bookmarks