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.
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.