Home  >  Article  >  Software Tutorial  >  How to merge multiple Excel worksheets into one

How to merge multiple Excel worksheets into one

王林
王林forward
2024-01-14 22:39:302859browse

How to merge the contents of multiple worksheets in excel into one worksheet solution

Is it excel?

Step one: Open your workbook and create an empty worksheet (position of sheet1)

Step 2: Tools Menu-Options-Security-Macro Security-Set to "Medium" etc.

Step 3: Tools menu-Macro-Macro-Macro name-Enter a name-Click Create

Step 4: A box pops up [Under "Sub merge worksheet ()", copy and paste the following characters]

Dim m As Integer

Dim n As Integer

Dim o As Integer

For m = 2 To 6

n = Sheets(m).[a65536].End(xlUp).Row

o = Sheets(1).[a65536].End(xlUp).Row

Sheets(m).Select

Range("a1", "z" & n).Select

Range("a" & n).Activate

Selection.Copy

Sheets(1).Select

Range("a"& o 1).Select

ActiveSheet.Paste

Next

Step 5: Note: For m = 2 To 6 If you have 5 worksheets, you will For m = 2 To 6

If there are 7, then For m = 2 To 8. If there are 8, then For m = 2 To 9

And so on

Step 6: Open the worksheet you created before, sheet1.

Step 7: Tools menu, select "Macro" - "Macro" and click Execute~

It’s ok~

How to quickly merge multiple excel sheets into one excel sheet and distinguish each sheet

Create a new folder and copy the excel documents that need to be merged into the document directory.

2/7

Create a new blank EXCEL document, move the mouse to the worksheet, right-click, select the "View Code" option, and enter the VBA console.

3/7

Click the "Insert" menu in the menu bar, select the "Module" option, and enter the module editing interface.

4/7

Copy the following code in the edit box, pay attention to the symbols, it must be in English.

'Function: Merge the first sheet of multiple excel workbooks into multiple sheets of one excel workbook. The name of the new worksheet is equal to the name of the original workbook. Sub Books2Sheets() 'Definition dialog Box variable Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker) 'Create a new workbook Dim newwb As Workbook Set newwb = Workbooks.Add With fd If .Show = -1 Then 'Define a single file variable Dim vrtSelectedItem As Variant 'Definition Loop variables, start file retrieval, open the merged workbook, copy the worksheet, change the worksheet name of the new workbook to the file name of the copied workbook, this applies to xls files,

5/7

After entering the code, click "Run" in the menu item and select the "Run subprocess" option, or press the F5 shortcut key to run the code.

6/7

After running the code, the document selection interface will pop up. Find the path to the new folder and select the documents you want to merge. After selecting the documents, click "Open". The code is running. The running time depends on the number of documents.

7/7

After the code segment is run, the merged excel document interface will appear. The name of the new worksheet is equal to the name of the original workbook.

Excuse me: How to merge data from multiple worksheets in one excel workbook

Because you will have a table every day and the total number of tables cannot be determined, you should copy each day's tables into one table in sequence and name this table Summary

This table lists the serial number in A, the name in B, the number of pieces in C, and the amount in D.

Then create a new table and name it directory

Enter the "name" content in each table, such as Shantou Omar, Chengdu Lean, etc., into column A of the "catalog" table without duplication. Starting from cell A1, each occupies one cell, and enter downwards in sequence. .

Enter the formula in the B1 box of the "Catalog" table to get the total number of pieces:

=SUMIF(Summary!$B$1:$B$1000, Directory!A1, Summary!$C$1:$C$1000)

Enter the formula in cell C1 of the "Table of Contents" table to get the total amount:

=SUMIF(Summary!$B$1:$B$1000, Directory!A1, Summary!$D$1:$D$1000)

Try it, if you have any questions, please comment! I.

How to merge the contents of multiple SHEETs in an EXCEL into one SHEET

The specific steps to merge the contents of multiple SHEETs in an EXCEL into one SHEET are as follows:

1. First we need to have our own excel data, and then we open Microsoft Excel on the computer to load the data to be merged.

How to merge multiple Excel worksheets into one

2. Seeing that there are so many data pages to merge, if you copy and paste, the workload will be huge. Let's start merging now. First, we need to create a new worksheet on the front page.

How to merge multiple Excel worksheets into one

3. "Right-click" in the newly created sheet and find "View Code".

How to merge multiple Excel worksheets into one

4. Then see the macro calculation interface.

How to merge multiple Excel worksheets into one

5. When we see the macro calculation interface, we only need to copy the following code into it.

How to merge multiple Excel worksheets into one

6. After completing the above, just click "Run Subprocess/User Form" under "Run" on the toolbar. There will be a prompt after the merger is completed. After the prompt is completed, you can close the macro calculation interface.

How to merge multiple Excel worksheets into one

7. The effect after the merger is as shown below. What we see is that there are more than 8,000 lines after the merger, which is the result of the merger of 205 pages.

How to merge multiple Excel worksheets into one

The above is the detailed content of How to merge multiple Excel worksheets into one. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete