Excel 365 Macro Question on copying multiple spreadsheets into one workbook

bthumble

Board Regular
Joined
Dec 18, 2007
Messages
231
Hello,

I have multiple dat files and want a macro that will put each file into a new excel workbook, with each dat file in a separate sheet. Found a macro on this site that might work, but the tab name has to be a specific name. Is there a way the macro would work no matter what the sheet name is? The files are in the same folder on the C drive. Also is there a way to move the files once they are copied into a subfolder called backup?

Thanks!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Is there a way the macro would work no matter what the sheet name is?
Since "dat" files are flat text files (meaning only one sheet), when you open it in Excel, you should just be able to use "ActiveSheet".

Also is there a way to move the files once they are copied into a subfolder called backup?
If you go a search on "excel vba move files to subfolder", you should find tons of results.
Here is just one: VBA Macro move files to sub folders

If you have existing code you want to modify, if you post the code here, we should be able to help you work it all out.
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

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