LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Fill an Array or Collection without knowing the UBound

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array values with UBound [email protected] Excel Programming 1 June 12th 07 10:17 PM
Array Ubound gti_jobert[_71_] Excel Programming 6 March 27th 06 10:34 PM
UBound of multi-dimensional array? Jake Marx[_3_] Excel Programming 0 August 16th 05 06:34 PM
Handling ubound on an uninitialised array Mike NG Excel Programming 14 January 24th 05 09:05 AM


All times are GMT +1. The time now is 09:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"