Mastermimo
New Member
- Joined
- Sep 13, 2019
- Messages
- 4
Hello Everybody,
I woud lile your help on some issues i'm facing when i try to populate a combobox from a specific range based on a certain condition. Below is a listbox i created that provides the summary of all the invoices registered (see image below as an example):
When i select an i select an invoice from the list above, i would like to see in another listbox as seen below the list of all the items in that invoice, per example invoice 1234 (but only 1234) and not the rest of the invoices.
I am perfectly able to populate the first listbox that gives me the summary of the invoices with this code below :
If anyone can please help me on how to do what i'm trying to do, such as populate the second list box based on the selection of the first one.
Thank you for your help in advance.
Amo.
I woud lile your help on some issues i'm facing when i try to populate a combobox from a specific range based on a certain condition. Below is a listbox i created that provides the summary of all the invoices registered (see image below as an example):
When i select an i select an invoice from the list above, i would like to see in another listbox as seen below the list of all the items in that invoice, per example invoice 1234 (but only 1234) and not the rest of the invoices.
I am perfectly able to populate the first listbox that gives me the summary of the invoices with this code below :
Code:
[COLOR=#0000FF]Sub[/COLOR][COLOR=#333333] populatelstSales[/COLOR][COLOR=#333333]([/COLOR][COLOR=#333333])[/COLOR]
[COLOR=#0000FF]Dim[/COLOR] ws [COLOR=#0000FF]As[/COLOR] Worksheet
[COLOR=#0000FF]Dim[/COLOR] rng [COLOR=#0000FF]As[/COLOR] Range
[COLOR=#0000FF]Dim[/COLOR] MyArray
[COLOR=#0000FF]Set[/COLOR] ws = Sheets([COLOR=#FF0000]"SalesRawData"[/COLOR])
[COLOR=#0000FF]Set[/COLOR] rng = ws.Range([COLOR=#FF0000]"B3:R"[/COLOR] & ws.Range([COLOR=#FF0000]"B"[/COLOR] & ws.Rows.Count).End(xlUp).Row)
[COLOR=#0000FF]With[/COLOR] Sheets([COLOR=#FF0000]"SALES"[/COLOR]).lstSales
.Clear
.ColumnHeads = [COLOR=#0000FF]False[/COLOR]
.ColumnCount = rng.Columns.Count
[COLOR=#808080]'~~> create a one based 2-dim datafield array[/COLOR]
MyArray = rng
[COLOR=#808080]'~~> fill listbox with array values[/COLOR]
.List = MyArray
[COLOR=#808080]'~~> Set the widths of the column here. Ex: For 5 Columns[/COLOR]
[COLOR=#808080]'~~> Change as Applicable[/COLOR]
.ColumnWidths = [COLOR=#FF0000]"100;100;100;100;100;100;150;"[/COLOR]
.TopIndex = [COLOR=#CC66CC]0[/COLOR]
[COLOR=#0000FF]End[/COLOR] [COLOR=#0000FF]With[/COLOR]
Range([COLOR=#FF0000]"A1"[/COLOR]).Select
[COLOR=#0000FF]End[/COLOR][COLOR=#333333] [/COLOR][COLOR=#0000FF]Sub[/COLOR]
If anyone can please help me on how to do what i'm trying to do, such as populate the second list box based on the selection of the first one.
Thank you for your help in advance.
Amo.