PDA

View Full Version : Combine worksheet one after another from folder



sachin482
02-10-2017, 08:50 AM
i have 60 workbook in a folder, then i want to select 2 workbook for merging one after another ie:- 2 sheets one after another not in one worksheet, hence finally 30 workbook with 2 sheets each and the name of the worksheet can be preserve


eg:- i have test.xlsx & test1.xlsx final result in newexcel.xlsx ie:- newexcel.xlsx in sheet1 & test1.xlsx in sheet2

can it be done

i have post the same on other forum

https://www.mrexcel.com/forum/excel-questions/990326-combine-worksheet-one-after-another-folder.html

DocAElstein
02-11-2017, 04:26 PM
Hi sachin482,

...can it be done...
It can almost certainly be done , and there are probably many ways to do it.

Here some general help to get you started:
_1) I would probably start by reading up on the
VBA Dir Function
Try a search with something like " Dir Function Loop Through all Files in a Folder VBA "
You can easily loop through all the files in a Folder using the Dir Function

_2) Then I would use the macro recorder to open two of your files , open a new File, and do all the operations that you wish to do.

It should then be fairly easy to modify the code which the macro recording gives you such that it does exactly what you want to do

_..........................................

For more specific help,

_(i) Upload two typical Files ( Desensitize the data if necessary ).
_(ii) Explain again in as much detail as you can, exactly what you want the code to do.
Alan