-3
다른 통합 문서의 워크 시트를 가져와야하는 코드는 다음과 같습니다. 하지만 필요한 것은 하나의 워크 시트 만 가져 오는 것입니다 (전부는 아님). 워크 시트의 이름을 가져온 원래 통합 문서에서 호출 한 것과 다른 이름으로 매크로를 변경해야합니다. 누구나 저 두 tweeks 도와 줄래? 여기하나의 워크 시트 만 가져 오기
는 내가 가진 무엇 :
Option Explicit
Private Sub Bring_Workbooks_Click()
Dim directory As String, fileName As String, sheet As Worksheet, total As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
directory = "access path to where the original workbook is stored"
fileName = Dir(directory & "Name of workboork where sheet will be copied from.xls")
Do While fileName <> ""
Workbooks.Open (directory & fileName)
For Each sheet In Workbooks(fileName).Worksheets
total = Workbooks("Name of my workbook.xlsm").Worksheets.Count
Workbooks(fileName).Worksheets(sheet.Name).Copy _
after:=Workbooks("Name of my workbook.xlsm").Worksheets(1)
Next sheet
Workbooks(fileName).Close
fileName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
어떻게 당신이 원본 통합 문서에서 복사 할 시트 식별합니까? –