Hi sdb
The Transpose option is only available as an option in PasteSpecial. You will need the following code:
If you know what range you want to put it in, the code to fill a column of cells looks something like:
The question is how to calculate the range. If you know where it relative to the 'destn' cell, you could use offset and resize. The following starts the range at a cell offset(0,-1), which is one cell to the left of the destn cell. Next, it resizes the range to 40 long - which is how many rows you are copying. It puts in the Val of the sheet number. If you didn't use the Val command, you would end up with a string in the cell, i.e. not a number. It would have value 0. The Val command turns that in to a number, i.e. 1 This means that, if you sort, the order will be 1,2,3,...10,11.. If you put in the text, the sort order would be 1,10,11,...,2,20,...
If you wanted to insert the shift number from the workbook name:
This code takes the first 1 characters from the left of the workbook name (wb is the workbooks you are looping through). Note - at present, both pieces of code above are using the same destination range. If you want both pieces of info, you will need to find somewhere different (e.g. Offset(0,-2)).
I hope this is enough of a clue. If not, upload the files using the Go Advanced button below, then hit Manage Attachments. Include a couple of files, and some clues on what information you want to appear where, and where the info comes from. A 'before' and 'after' is a good way to do it, including the source files.
Cheers, Rob.
Bookmarks