如何用VBA把一个工作簿中的工作表内容复制到另一个汇总工作簿里面的指定的工作表里面去?

2024-10-31 09:24:27
推荐回答(2个)
回答(1):

将工作薄A 的工作表移动到工作簿B中


  1. 打开两个工作簿 A 和B

  2. 选取工作簿A中所需要的工作表,右键

  3. 移动或复制

  4. 选择工作簿B

  5. 建立副本 即可

回答(2):

private Sub bookMerge(nstart As Long, ncolumn As Integer)
' MsgBox "欢迎使用合并工作表工具1.0" & Chr(13) & "made by excel880工作室" & Chr(13) _
' & "本工具将合并当前目录下所有工作簿的第一个工作表到一个工作簿"
'
Dim fs, f, f1, fc, s
Dim wk As Workbook, sht As Worksheet
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(ThisWorkbook.Path)
Set fc = f.Files

Set targetWk = Workbooks.Add
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\合并.xls"
Set targetSht = ActiveWorkbook.Sheets(1)
targetSht.Name = "合并"
Application.DisplayAlerts = False
Application.ScreenUpdating = False
' Set targetWk = Workbooks.Open(ThisWorkbook.Path & "\" & "合并.xls")
' Set targetSht = targetWk.Sheets(1)