使用下列操作之一:
Option Explicit
Public Sub valuesCopy()
With DeptReceivedWB.Sheets(1).Cells(1, 1).CurrentRegion
.Offset(1).Resize(.Rows.Count - 1, .Columns.Count).Copy
End With
APPS_AuditWB.Sheets(3).Cells(1, 1).PasteSpecial xlPasteValues
End Sub
Public Sub directCopy1()
Dim cr As Range, fr As Long, lr As Long, fc As Long, lc As Long
Set cr = DeptReceivedWB.Sheets(1).Cells(1, 1).CurrentRegion
fr = cr.Row: lr = fr + cr.Rows.Count - 2
fc = cr.Column: lc = fc + cr.Columns.Count - 1
Set cr = cr.Offset(1).Resize(lr, lc)
With APPS_AuditWB.Sheets(3)
.Range(.Cells(fr, fc), .Cells(lr, lc)).Value2 = cr.Value2
End With
End Sub
Public Sub directCopy2()
Dim cr As Range, fr As Long, lr As Long, fc As Long, lc As Long
Set cr = DeptReceivedWB.Sheets(1).Cells(1, 1).CurrentRegion
fr = cr.Row: lr = cr.Rows.Count - 1
fc = cr.Column: lc = cr.Columns.Count
Set cr = cr.Offset(1).Resize(lr, lc)
With APPS_AuditWB.Sheets(3)
.Cells(fr, fc).Resize(lr, lc).Value2 = cr.Value2
End With
End Sub
如果您不需要格式化,只需將一個範圍設置爲另一個。避免複製/粘貼在一起。 – findwindow