In an excel UserForm, I have 6 text boxes and a list box.
The listbox list is a table. When I open the userform and click on an item in the list box, the values are displayed in the text boxes on the userform.
This allows the user to edit the record.
I want to incorporate a combobox to do the same thing.
The combobox list is as followed:
When a "Billing Office" is selected, I want to populate the text boxes on the userfrom the same was as when I click on the list box item.
The user does not have access to the actual table, I am doing it all from a userform. When there is lots of entries in the table,
I think it would be easier to select the record to edit from a combobox rather than looking through all the listbox records.
I can't seem to figure out the syntax. Everything I have tried results in an error, could not et the list property...
All help is much appreciated!
The listbox list is a table. When I open the userform and click on an item in the list box, the values are displayed in the text boxes on the userform.
This allows the user to edit the record.
VBA Code:
Private Sub ListBoxBillingAddress_Click()
Me.txtbxBillingOffice.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 0)
Me.textboxCompany.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 1)
Me.textboxAddress.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 2)
Me.textboxCity.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 3)
Me.comboState.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 4)
Me.textboxZip.Value = Me.ListBoxBillingAddress.List(ListBoxBillingAddress.ListIndex, 5)
End Sub
The combobox list is as followed:
VBA Code:
Me.cboSearch.List = ThisWorkbook.Worksheets("Billing").Range("tblBilling[Billing Office]").Value
The user does not have access to the actual table, I am doing it all from a userform. When there is lots of entries in the table,
I think it would be easier to select the record to edit from a combobox rather than looking through all the listbox records.
I can't seem to figure out the syntax. Everything I have tried results in an error, could not et the list property...
All help is much appreciated!