메인 컨텐츠로 가기

Excel에서 여러 통합 문서를 하나의 마스터 통합 문서로 결합하는 방법은 무엇입니까?

Excel에서 여러 통합 문서를 하나의 마스터 통합 문서로 결합해야 할 때 막힌 적이 있습니까? 가장 끔찍한 것은 결합해야하는 통합 문서에 여러 워크 시트가 포함되어 있다는 것입니다. 그리고 여러 통합 문서의 지정된 워크 시트 만 하나의 통합 문서로 결합하는 방법은 무엇입니까? 이 튜토리얼은 단계별로 문제를 해결하는 데 도움이되는 몇 가지 유용한 방법을 보여줍니다.


이동 또는 복사 기능을 사용하여 여러 통합 문서를 하나의 통합 문서로 결합

몇 개의 통합 문서 만 결합해야하는 경우 이동 또는 복사 명령을 사용하여 워크 시트를 원본 통합 문서에서 마스터 통합 문서로 수동으로 이동하거나 복사 할 수 있습니다.

1. 마스터 통합 문서로 병합 할 통합 문서를 엽니 다.

2. 마스터 통합 문서로 이동하거나 복사 할 원본 통합 문서의 워크 시트를 선택합니다.

배송 시 요청 사항:

1). 여러 개의 인접하지 않은 워크 시트를 선택할 수 있습니다. Ctrl 키 키를 누르고 시트 탭을 하나씩 클릭합니다.

2). 인접한 여러 워크 시트를 선택하려면 첫 번째 시트 탭을 클릭하고 변화 키를 누른 다음 마지막 시트 탭을 클릭하여 모두 선택합니다.

삼). 시트 탭을 마우스 오른쪽 버튼으로 클릭하고 모든 시트 선택 상황에 맞는 메뉴에서 통합 문서의 모든 워크 시트를 동시에 선택합니다.

3. 필요한 워크 시트를 선택한 후 시트 탭을 마우스 오른쪽 단추로 클릭 한 다음 이동 또는 복사 상황에 맞는 메뉴에서. 스크린 샷보기 :

4. 그런 다음 이동 또는 복사 대화 상자가 나타납니다. 예약하려면 드롭 다운에서 워크 시트를 이동하거나 복사 할 마스터 통합 문서를 선택합니다. 이동을 선택하여 시트 전 상자에서 사본 만들기 상자를 클릭하고 마지막으로 OK 버튼을 클릭합니다.

그런 다음 두 통합 문서의 워크 시트가 하나로 결합 된 것을 볼 수 있습니다. 위의 단계를 반복하여 다른 통합 문서의 워크 시트를 마스터 통합 문서로 이동하십시오.


VBA를 사용하여 여러 통합 문서 또는 지정된 통합 문서 시트를 마스터 통합 문서에 결합

여러 통합 문서를 하나로 병합해야하는 경우 다음 VBA 코드를 적용하여 신속하게 수행 할 수 있습니다. 다음과 같이하십시오.

1. 결합하려는 모든 통합 문서를 동일한 디렉터리 아래에 하나에 넣습니다.

2. Excel 파일을 시작합니다 (이 통합 문서가 마스터 통합 문서가 됨).

3. 누르세요 다른 + F11 키를 눌러 애플리케이션 용 Microsoft Visual Basic 창문. 에서 애플리케이션 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다 > 모듈, 그런 다음 VBA 코드 아래를 모듈 창에 복사하십시오.

VBA 코드 1 : 여러 Excel 통합 문서를 하나로 병합

Sub GetSheets()
'Updated by Extendoffice 2019/2/20
Path = "C:\Users\dt\Desktop\dt kte\"
Filename = Dir(Path & "*.xlsx")
  Do While Filename <> ""
  Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
     For Each Sheet In ActiveWorkbook.Sheets
     Sheet.Copy After:=ThisWorkbook.Sheets(1)
  Next Sheet
     Workbooks(Filename).Close
     Filename = Dir()
  Loop
End Sub
	

배송 시 요청 사항:

1. 위의 VBA 코드는 병합 후 원본 통합 문서의 시트 이름을 유지합니다.

2. 마스터 통합 문서의 어떤 워크 시트가 병합 후 어디에서 왔는지 구별하려면 아래 VBA 코드 2를 적용하십시오.

3. 통합 문서의 지정된 워크 시트를 마스터 통합 문서로 결합하려는 경우 아래 VBA 코드 3이 도움이 될 수 있습니다.

VBA 코드에서 "C : \ 사용자 \ DT168 \ Desktop \ KTE \”는 폴더 경로입니다. VBA 코드 3에서 "Sheet1, Sheet3"는 마스터 통합 문서로 결합 할 통합 문서의 지정된 워크 시트입니다. 필요에 따라 변경할 수 있습니다.

VBA 코드 2 : 통합 문서를 하나로 병합 (각 워크 시트의 이름은 원래 파일 이름의 접두사로 지정됨) :

Sub MergeWorkbooks()
'Updated by Extendoffice 2019/2/20
Dim xStrPath As String
Dim xStrFName As String
Dim xWS As Worksheet
Dim xMWS As Worksheet
Dim xTWB As Workbook
Dim xStrAWBName As String
On Error Resume Next
xStrPath = "C:\Users\DT168\Desktop\KTE\"
xStrFName = Dir(xStrPath & "*.xlsx")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set xTWB = ThisWorkbook
Do While Len(xStrFName) > 0
    Workbooks.Open Filename:=xStrPath & xStrFName, ReadOnly:=True
    xStrAWBName = ActiveWorkbook.Name
    For Each xWS In ActiveWorkbook.Sheets
    xWS.Copy After:=xTWB.Sheets(xTWB.Sheets.Count)
    Set xMWS = xTWB.Sheets(xTWB.Sheets.Count)
    xMWS.Name = xStrAWBName & "(" & xMWS.Name & ")"
    Next xWS
    Workbooks(xStrAWBName).Close
    xStrFName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

VBA 코드 3 : 통합 문서의 지정된 워크 시트를 마스터 통합 문서로 병합 :

Sub MergeSheets2()
'Updated by Extendoffice 2019/2/20
Dim xStrPath As String
Dim xStrFName As String
Dim xWS As Worksheet
Dim xMWS As Worksheet
Dim xTWB As Workbook
Dim xStrAWBName As String
Dim xI As Integer
On Error Resume Next

xStrPath = " C:\Users\DT168\Desktop\KTE\"
xStrName = "Sheet1,Sheet3"

xArr = Split(xStrName, ",")

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set xTWB = ThisWorkbook
xStrFName = Dir(xStrPath & "*.xlsx")
Do While Len(xStrFName) > 0
Workbooks.Open Filename:=xStrPath & xStrFName, ReadOnly:=True
xStrAWBName = ActiveWorkbook.Name
For Each xWS In ActiveWorkbook.Sheets
For xI = 0 To UBound(xArr)
If xWS.Name = xArr(xI) Then
xWS.Copy After:=xTWB.Sheets(xTWB.Sheets.count)
Set xMWS = xTWB.Sheets(xTWB.Sheets.count)
xMWS.Name = xStrAWBName & "(" & xArr(xI) & ")"
Exit For
End If
Next xI
Next xWS
Workbooks(xStrAWBName).Close
xStrFName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub

4. 누르세요 F5 코드를 실행하는 키입니다. 그런 다음 특정 폴더에있는 통합 문서의 모든 워크 시트 또는 지정된 워크 시트가 한 번에 마스터 통합 문서로 결합됩니다.


여러 통합 문서 또는 지정된 통합 문서 시트를 하나의 통합 문서로 쉽게 결합

다행히도 결합 통합 문서 유틸리티 Excel 용 Kutools 여러 통합 문서를 하나로 병합하는 것이 훨씬 쉽습니다. 여러 통합 문서를 결합 할 때이 함수가 작동하도록하는 방법을 살펴 보겠습니다.

신청하기 전에 Excel 용 Kutools, 제발 먼저 다운로드하여 설치하십시오..

1. 새 통합 문서를 만들고 쿠툴즈 플러스 > 결합. 그런 다음 결합 된 모든 통합 문서를 저장해야하며 보호 된 통합 문서에 기능을 적용 할 수 없음을 알리는 대화 상자가 나타납니다. OK 버튼을 클릭합니다.

2. 에서 워크 시트 결합 마법사, 선택 통합 문서의 여러 워크 시트를 하나의 통합 문서로 결합 옵션을 클릭 한 다음 다음 보기 단추. 스크린 샷보기 :

3. 에서 워크 시트 결합-2 단계 중 3 단계 대화 상자에서 추가 > 입양 부모로서의 귀하의 적합성을 결정하기 위해 미국 이민국에 or 폴더 하나로 병합 할 Excel 파일을 추가합니다. Excel 파일을 추가 한 후 마감재 버튼을 클릭하고 마스터 통합 문서를 저장할 폴더를 선택합니다. 스크린 샷보기 :

이제 모든 통합 문서가 하나로 병합됩니다.

위의 두 가지 방법과 비교하면 Excel 용 Kutools 다음과 같은 이점이 있습니다.

  • 1) 모든 통합 문서와 워크 시트가 대화 상자에 나열됩니다.
  • 2) 병합에서 제외하려는 워크 시트의 경우 선택을 취소하십시오.
  • 3) 빈 워크 시트는 자동으로 제외됩니다.
  • 4) 병합 후 원래 파일 이름이 시트 이름에 접두사로 추가됩니다.
  • 이 기능의 더 많은 기능을 보려면 여기를 방문하십시오.

  이 유틸리티의 무료 평가판 (30 일)을 받으려면 그것을 다운로드하려면 클릭하십시오을 클릭 한 다음 위 단계에 따라 작업 적용으로 이동합니다.


Excel 용 Kutools- 항상 미리 작업을 완료하고 인생을 즐길 수있는 더 많은 시간을 가질 수 있도록 도와줍니다.
자신과 가족을 위해 시간을 할애하지 않고 일을 따라 잡는 자신을 자주 발견하십니까?  Excel 용 Kutools 처리하는 데 도움을 줄 수 있습니다. 80% 엑셀 퍼즐과 80%의 작업 효율성을 향상시켜 가족을 돌보고 삶을 즐길 수 있는 더 많은 시간을 제공합니다.
300가지 작업 시나리오를 위한 1500가지 고급 도구로 작업이 그 어느 때보다 훨씬 쉬워집니다.
더 이상 공식과 VBA 코드를 암기 할 필요가 없습니다. 이제부터 두뇌에 휴식을 취하세요.
복잡하고 반복되는 작업은 몇 초 만에 한 번 처리 할 수 ​​있습니다.
매일 수천 건의 키보드 및 마우스 작업을 줄이고 지금 직업병에 작별 인사를하십시오.
3 분 안에 Excel 전문가가되어 빠르게 인정 받고 급여 인상 프로모션을받을 수 있습니다.
110,000 명의 매우 효과적인 사람들과 300 개 이상의 세계적으로 유명한 기업의 선택.
$ 39.0의 가치를 다른 사람의 $ 4000.0보다 더 가치있게 만드십시오.
전체 기능을 30일 동안 무료로 평가할 수 있습니다. 이유 없이 60일 환불 보장.

Comments (146)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have one workbook with 100+ sheets, I want to move all 100+ sheets into another workbook in a single sheet.
This comment was minimized by the moderator on the site
I had to read throught the comments to find suggestions that worked for my application of the VBA CODE 2, but I managed to get it to work doing the following things:
1. make sure to change "C:\Users\DT168\Desktop\KTE\" to your own directory to wherever you have your files are located. don't forget the extra "\" at the end!2. my spreadsheets were extension ".xls", so I deleted the extra "x" in this line, like so: xStrFName = Dir(xStrPath & "*.xlsx")3. I placed all my spreadsheets in a single folder, and only those files were the contents of that folder, the target macro enabled spreadsheet where this vba was running from was saved outside of this folder (hopefully this makes sense).
one thing that I didn't want to mess with though is I only needed to merge the 1st tab of each spreadsheet, but I didn't want to mess with the code so if each workbook you want to merge into one has multiple tabs, this code will grab all of the tabs on each workbook and place them in your target spreadsheet, I had to manually delete all the tabs I didn't want.
if the author of this vba could reply to me, how do you change the code to just copy the 1st tab as opposed to all the tabs?
thank you!
This comment was minimized by the moderator on the site
hi I want a change. If the the sheet name is same then the data should be appended in the same name sheet rather than adding a sheet. for example if i have 10 files with jan, feb, mar same sheetnames. then result should be 1 file having jan, feb, mar only 3 sheets with the data of all 10 files. thanks
This comment was minimized by the moderator on the site
Good morning,

Basically I have to copy the values of another file example c: \ test.xlsx (sheet name "date"):

I have to copy the values from A2: T20


And I have to paste in another Extract.xlsx file on the “Extracts” folder on A2.


PLEASE NOTE: You must run vba when opening the file.
This comment was minimized by the moderator on the site
Hello! I need to merge multiple files into one, that are password protected. All source files use the same password. What changes are needed to the first VBA script to merge the files without having to enter the password each time?
This comment was minimized by the moderator on the site
Hello any one can help me, I want to combine sheet 2 only from 5 different sheet, can you script for me.
This comment was minimized by the moderator on the site
you can use Array function to copy the multiple sheets to combine in one file
Sheets(Array("Sheet1","Sheet2")).copy
This comment was minimized by the moderator on the site
hai sir i want know code for copying multiple sheets in one excel to multiple excels
This comment was minimized by the moderator on the site
Sheets(Array("Sheet1","Sheet2")).copy
This comment was minimized by the moderator on the site
hai sir i want know code for copying multiple sheets in one excel to multiple excels
This comment was minimized by the moderator on the site
how to use VBA code 1 to amend and make it runs to combine all the .xlsx files into one excel file and each excel spreedsheet tab in the combined excel file should be named as original file name.thanks
This comment was minimized by the moderator on the site
What part of VBA code 3 specifies the name of the worksheet to be copied?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations