Converting multiple items to a list

xzmike

Board Regular
Joined
Feb 15, 2002
Messages
110
I've queried an Access table to Excel that I'm trying to turn into a list.

The table:
Case Name Fee1Type $Amt Fee2Type $Amt Fee3Type $Amt
1 Park Sanitation $10 Postal $15 Postal $$4
2 Jones Postal $5 Livery $20 Sanitation $30
(Many more rows and 6 fee types)

The List:
Case Name Fee1Type $Amt Fee2Type $Amt
1 Park Sanitation $10
1 Park Postal $15
1 Park Postal $4
2 Jones Postal $5
2 Jones Livery $20
2 Jones Sanitation $30


My pseudocode will run something like this: (Assume I've got a count on the number of names and I'm starting at line 2, the first name))


Do until current line, column A= ""
Down a line and insert
Back up a line & copy this line, col (Case,Name,Fee1Type,$Amt)
Down a line & paste.

Down a line and insert
Back up 2 lines & copy this line, col (Case,Name,Fee2Type,$Amt )
Down 2 lines & paste.

Down a line and insert
Back up 3 lines & copy this line, col (Case,Name,Fee3Type,$Amt )
Down 3 lines & paste.

Down a line
Loop

Can this be done more efficiently? I tried to figure out how to get the worksheet into an array, but couldn't.

Here's as far as I got. (Option Base 1)

Dim SubdvsnArray(1 to 2, 1 to 3)
dim rows as integer
dim cols as integer

For rows=1 to 2
For cols=1 to 3
SubdvsnArray(rows,cols)=cells((rows+1),col????)
next cols
next rows

The problem is I've got data in columns 4,5,6,7 and beyond & I can't figure out how to load the array since the cols would be out of subscript.

Any help appreciated
Mike
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,038
Messages
6,122,798
Members
449,095
Latest member
m_smith_solihull

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