VBA Code to Copy Data from Multiple Files in a Folder and Copy to 1 Sheet

tiredtea

New Member
Joined
May 7, 2020
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
Hello Mr. Excel gang,

I have spent 10 hours trying and trying my hand at this code. It seems like a repetitive question after scouring the web yet any code I came across gave me some kind of issue, even with hours of tinkering. That being said - SOS

>I have hundreds of files in a folder on my X drive
>They all only have one sheet, titled "Incident Report"
>They have a various number of lines, all typically maxing out at line 10,027.
>Each workbooks' data starts at line A28.
>Each column has data to column AA (last column with data. Column AB and onwards is empty)

I just want to copy all of this data into my original open sheet (Sheet1) without any line gaps in the data.

As an aside, these files all downloaded as as an Excel HTTP Page? So every time you try to open one of the files, you get the error that I have attached below. But if you click "Yes", it opens as expected. Is that an underlying issue?
 

Attachments

  • 2Error.PNG
    2Error.PNG
    59.5 KB · Views: 12

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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