Fill an Array or Collection without knowing the UBound

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have a workbook that has a userform in it that the sales team uses to quote
prices for the signs we manufacture. The user calls the userform and then
selects all the specifications of the sign by using checkboxes, option boxes,
comboboxes, etc. I am trying to build a "Bill of Material" for the sign that
the sales person quotes. This "Bill of Material" will contain a parts list
of all the parts used to make that sign, along with the part number, part
price, and part description. I have a master list of all the parts in our
inventory on a worksheet named Sheets("Parts List"). It is laid out like so.

A B C
D
Part Number Part Description Units Part Price
EXT0001111 Aluminum Extrusion ft. $5.50

If a particular part is used in the quoted sign I want to capture the values
in Range A:D on that parts row along with the quantity allocated to that
sign. For example, if PartA is used and is located on Row 100 I want this
stored in an Array or Collection: Range("A100:D100"), 5. 5 being the
quantity of PartA that is used for the sign.

This is my question. If I use an Array how do I fill it with multiple
Ranges and Quantities without knowing how many parts will be used? Or should
I use a collection? Will the collection hold values or just objects?

Once the Array is filled I then will use a loop to fill those values in my
"Bill of Material" worksheet.

For i = LBound(myArray) to UBound(myArray)

' A-part number, B-part description, C-part unit, D-part cost
Sheets("Bill of Material").Range("A10:D10").Value = myArray(i)

' quantity of part used
Sheets("Bill of Material").Range("E10").Value = myArray(i+1)
Next i

--
Cheers,
Ryan
.



Relevant Pages

  • Re: TextBox formatting (Revisited)
    ... When the userform is shown I would like the textboxes to ... always have the "price" format. ... and enter the prices they are in the correct "price" ... When I save and close the spreadsheet after making ...
    (microsoft.public.excel.programming)
  • Re: New Poll on WindSurfing Mag...
    ... -start quote ... because there seems to be a lot of competition for our windsurfing ... Do you feel there a general impression that prices are inflated (more ...
    (rec.windsurfing)
  • Re: Slowing housing ...
    ... Selective snipping of the article & quotes, ... And of course you chose to leave out the entire rest of the quote, ... Home prices are 20 ... prices down and force appraisers to get more realistic. ...
    (misc.news.internet.discuss)
  • Re: mapping IPs
    ... but it gives undiscounted prices. ... a Silver partner should be able to get an arbitrary-period ... such a quote directly. ... discount, but they vary in how much of that discount they will pass on ...
    (comp.dcom.sys.cisco)
  • Re: Services Offered
    ... >>> I'm a local chap offering PC repair and servicing. ... >>> and can offer reliable quotes. ... >>> And a quote to leave you with.. ... > and offers a local service, the prices are fantastic - a 19" TFT monitor ...
    (uk.local.shropshire)