VBA 把一个工作簿中的表的数据传递到另一个工作簿中

Private Sub CommandButton2_Click()
For Z = 2 To Sheet2.[b65536].End(3).Row

Next
Application.ScreenUpdating = False
Dim j As Integer
Dim souce As Worksheet
Dim target As Workbook
 Set souce = ThisWorkbook.Worksheets("正式表")

          Set target = Workbooks.Open(ThisWorkbook.Path & "\凭证.xls")
          target.Sheets(1).Rows.Delete

           souce.Range(souce.Cells(1, 1), souce.Cells(Z - 1, 38)).Copy target.Sheets(1).Range(target.Sheets(1).Cells(1, 1), target.Sheets(1).Cells(Z - 1, 38))


           Application.ScreenUpdating = True
         ActiveWorkbook.Save
  ActiveWorkbook.Close

End Sub

把一个工作簿中的表的数据传递到另一个工作簿中。

猜你喜欢

转载自www.cnblogs.com/flyer2018/p/10130423.html