We have a table of invoices with 17 columns in.
I have a combo box which populates with the Tenant's company names in and then an invoice number combo box which populates with ONLY the invoices relevant to the tenant selected in the TenantComboBox.
However I need the InvoiceNoComboBox to only show invoices relevant to the selected Tenant WHERE the Invoice isn't already paid. There is a column in the invoice table where the value is "" if it is unpaid or it will have a date in if it is paid.
Code so far for the populating of combo box:
Any help greatly appreciated!!
I have a combo box which populates with the Tenant's company names in and then an invoice number combo box which populates with ONLY the invoices relevant to the tenant selected in the TenantComboBox.
However I need the InvoiceNoComboBox to only show invoices relevant to the selected Tenant WHERE the Invoice isn't already paid. There is a column in the invoice table where the value is "" if it is unpaid or it will have a date in if it is paid.
Code so far for the populating of combo box:
VBA Code:
Private Sub TenantComboBox_Change()
'Populate InvoiceNoComboBox with Invoice Numbers of the Selected Tenant
Dim rngTenant As Range
Dim rngList As Range
Dim rngFilterList As Range
Dim strSelected As String
Dim LastRow As Long
If TenantComboBox.ListIndex <> "" Then
strSelected = TenantComboBox.Value
LastRow = Worksheets("Outstanding List").Range("E" & Rows.Count).End(xlUp).Row
Set rngList = Worksheets("Outstanding List").Range("E14:E" & LastRow)
Set rngFilterList = Worksheets("Outstanding List").Range("T14:T" & LastRow)
For Each rngTenant In rngList
If rngFilterList.Value <> "" Then
If rngTenant.Value = strSelected Then
InvoiceNoComboBox.AddItem rngTenant.Offset(, 2)
End If
Next rngTenant
End If
End Sub
Any help greatly appreciated!!