VBA to cycle through Workbooks, extract data and paste to a single workbook

andysweeney

New Member
Joined
Mar 8, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
HI all,

Struggling on this one despite seeing answers for some similar things.

I need some VBA to copy the data from Row 2 until the last populated row from every workbook in a designated folder into a single worksheet. The main issue that I have with previous answers is that the worksheets within any workbook are all named differently. (ie. not called "Sheet1")

Any help appreciated!

Andy
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
1. You have save all the required workbooks in a folder - that is great.
2. Now you can program the macro to:
a. Open this folder
b. For Each workbook in the folder, check the filename pattern (if required)
c. Open each workbook in turn (and identify that workbook positively, by assigning it a variable name)
d. For each open workbook, look for each tab (since they are named differently, if there is a particular name pattern, that is great)
e. If you can identify the tab name, proceed to copy.
f. If you do not know the tab name, then you may have to search for patterns in the worksheet column headings in each worksheet)
g. When you find the correct heading pattern, proceed to copy.
h. Finally, close the workbook.
i. Repeat till all workbooks have been copied.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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