# Select a row range from a table; choice of table chosen by a cell value

1. ## Select a row range from a table; choice of table chosen by a cell value

Hi guys, I'm new at this and not used to the terminolgy, so please excuse errors! I can just about tackle formulas but suspect VBA is code is needed to solve this problem.

In a worksheet, the value of cell A4 is determined from a previous operation.

The value of A4 is between 100 and 200.
Each value of A4 represents a pricing table, with products along the top and quantity price breaks running down, eg:

A B C D E F
1-11 30 40 50 60 70 80
11-20 29 39 49 59 69 79
21-30 27 36 46 55 68 77
31-50 24 33 42 51 66 75
51+ 21 31 40 50 65 72

All the 100 pricing 'tables' contain different data. All 'tables' are contained lower down the worksheet.

The value of another cell, A5, contains the previously determined quantity of product the customer wants to buy (value is in the range 1-50+)

From the table number (A4) and the quantity (A5) I need to select and paste the relevant row values (the prices of products A-F) into a row, with the first cell at A6.

eg. if the above pricing table was selected and the custom buys 27 items, the values 27, 36, 46, 55, 68 and 77 would fill cells A6-A11.

Not being familiar enough with arrays and such like, the solution is beyond me right now. Any help would be hugely appreciated.

Many thanks indeed

2. ## Re: Select a row range from a table; choice of table chosen by a cell value

Welcome to the forum.

Post a workbook with an example.

3. ## Re: Select a row range from a table; choice of table chosen by a cell value

well if you have time!
restructure your table as shown
then name all 100 tables
using insert/name/define
(do that to view ones ive done)
then
use indirect in a vlookup as in yellow cells

4. ## Re: Select a row range from a table; choice of table chosen by a cell value

Hi shg, an example worksheet is attached.

5. ## Re: Select a row range from a table; choice of table chosen by a cell value

Hi martindwilson,

You solution works a treat.

And renaming the tables won't take nearly as long as spent on this problem up till now!

Many thanks and much appreciation,
Julian

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1