Finding multiple rows from table in external workbook with criteria in 2 columns

GeorgeThalassinos

New Member
Joined
May 23, 2013
Messages
1
I have a workbook where the user inputs an Item Code and I want to present them with a list of LOT numbers (from a Table existing in another workbook) to choose from. The list will then be used in a list box so I would like the result in an array.

So my input is an Item Code (I am not sure if it is a string or a number yet) and with that I need to select all the LOT numbers in the external table where ItemCode=InputValue (variable, first criterion) and Status = 5 (fixed value, second criterion) and load an array with the results from the LOTnumber column. In the following example this would be {10005, 10007}.

The table is an Excel 2010 TABLE object
[TABLE="width: 780"]
<colgroup><col><col><col><col><col><col span="2"></colgroup><tbody>[TR]
[TD]
Book Test.xlsm

range("C_INPUTVALUE").value = 4007221031383

Book PROD.xlsm

Table PROD.xlsm!T_PRODUCTION[#Data]

[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD]fld1[/TD]
[TD]Itemcode[/TD]
[TD]Itemdesc[/TD]
[TD]LOTnumber[/TD]
[TD]Status[/TD]
[/TR]
[TR]
[TD]q[/TD]
[TD][TABLE="width: 115"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]28030100[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 286"]
<colgroup><col></colgroup><tbody>[TR]
[TD]item1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 75"]
<colgroup><col></colgroup><tbody>[TR]
[TD]10001[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 33"]
<colgroup><col></colgroup><tbody>[TR]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]q[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10004[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]q[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10002[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]q[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10005[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]wt[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10007[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]ret[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10003[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]34[/TD]
[TD="align: right"]28030100[/TD]
[TD]item1[/TD]
[TD]10008[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]22[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10006[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4007221031383[/TD]
[TD]item2[/TD]
[TD]10009[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[TD]

[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I know how to do this with loops but I would like to find a way using objects. I am just starting with them but I see that there is an advantage there.

Any help will be greatly appreciated.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top