Converting multiple items to a list

xzmike

Board Regular
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Replies
1
Views
174
Replies
5
Views
175
Replies
0
Views
135
Replies
5
Views
562
Replies
1
Views
137

1,187,175
Messages
5,962,044
Members
438,578
Latest member
MrJimC

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.

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

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