用VBA将工作簿1中的全部SHEET复制到当前打开的工作簿2中,工作簿1可以手动选择
3个回答
展开全部
Sub 工作簿间表复制()
Dim S As String, WyN As String
Dim Wb As Object
WyN = ActiveWorkbook.Name
S = Application.GetOpenFilename("(*.xls),*.xls", 1, "选择要复制的Excel文件")
If S <> "False" Then
Set Wb = Workbooks.Open(S)
For I = 1 To Wb.Worksheets.Count
If Wb.Worksheets(I).UsedRange.Count > 1 Then Wb.Sheets(I).Copy before:=Workbooks(WyN).Sheets(1)
Next I
Wb.Close
End If
End Sub
以上代码能满足你的要求,空表就不复制。如有问题请联系
Dim S As String, WyN As String
Dim Wb As Object
WyN = ActiveWorkbook.Name
S = Application.GetOpenFilename("(*.xls),*.xls", 1, "选择要复制的Excel文件")
If S <> "False" Then
Set Wb = Workbooks.Open(S)
For I = 1 To Wb.Worksheets.Count
If Wb.Worksheets(I).UsedRange.Count > 1 Then Wb.Sheets(I).Copy before:=Workbooks(WyN).Sheets(1)
Next I
Wb.Close
End If
End Sub
以上代码能满足你的要求,空表就不复制。如有问题请联系
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询