VBA merge multiple Excel files

1. Introduction to the original data

The original data is 4 excel files in xls
Insert picture description here
format. The format is: the first row is the variable name, the second row and after are the data, and the number of variables is 8.
Insert picture description here
Each excel means 745 rows of data (including the first row of variable names). The 4 excel data has a total of 745*4=2980 rows.
Insert picture description here

2. Open the vba running interface and enter the corresponding code.

Insert picture description here

3. After running, the results are as follows.

Prompt: 4 excel files are merged, and the names of each excel file are listed. The first row of the merged data is a blank row.
Insert picture description here
The number of columns is 8 columns. The total number of rows is 2981, minus the blank rows: the number of rows containing data is 2980, which is exactly the total amount of data in 4 original Excel files.
Insert picture description here

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/114323956
Recommended