Loop through sheets on multiple workbooks

CalRich1023

New Member
Joined
Mar 15, 2021
Messages
48
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello!

This could be a bit complicated, but I am going to try to explain this as best I can.

I need a VBA code to loop through most (not all) sheets on about 10-12 different workbooks (I can add more WB names to the code as they are created) and extract a varying range of cells that will be anywhere from 1 line to 100 lines of data per sheet. Maybe it could be helpful to put all necessary workbooks into a dedicated folder, and then search the entire folder? I want this data to be copied into a new workbook (where the code will be written) so it can be further analyzed, all in one place. There are going to be 100's, maybe upwards of 1000 sheets in total to loop through when it is all said and done.
  • The range will begin in cells J9:P9 and continue downward with a different number of lines on each sheet (end.xlup maybe?)
    • This will be the same starting cells for each sheet.
    • It may be important to note that this range does contain an array, so this may throw a kink in things.
  • The Sheet Names that need to be EXCLUDED from the search (every workbook is the same) are:
    • MASTER PIVOT
    • Table Of Contents
    • SEARCH
    • COPY TEMPLATE
    • ACCT #'S
    • DATA
  • The Workbook names that need to be searched are:
    • Inventory_1
    • Inventory_2
    • Inventory_3
    • etc.
I hope this makes sense and I REALLY appreciate all help that anyone can provide. This is an outstanding community that has helped me sooo much in the past and I look forward to more assistance with this project. Thank you all so much!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi,​
this is a common subject you can find whatever the Excel forum …​
But as often it's the basic beginner way - open a workbook, copy sheets data, close the workbook - so according to your description​
this kind of VBA procedure may last a while !​
To speed it up an advanced way like using some SQL via an activeX object should be used but as it depends on how smart are designed the worksheets …​
For further assistance as here this is just an Excel forum and not some mind readers one so to explore any way we need a zip file​
containing some representative source workbooks and accordingly an accurate expected result workbook where the VBA procedure will be located.​
Link this zip file on a files host website like Dropbox …​
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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