|
Sub 备份()
With Sheets("价格")
r = .Cells(Rows.Count, 2).End(xlUp).Row
If r < 3 Then MsgBox "数据表为空": Exit Sub
ar = .Range("b3:e" & r)
br = .Range("g3:p" & r)
End With
f = Dir(ThisWorkbook.Path & "\备份资料表.xls*")
If f = "" Then MsgBox "找不到备份资料表": Exit Sub
Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & f, 0)
With wb.Worksheets(1)
rs = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(rs, 1).Resize(UBound(ar), UBound(ar, 2)) = ar
.Cells(rs, 5).Resize(UBound(br), UBound(br, 2)) = br
End With
wb.Close True
MsgBox "ok!"
End Sub
|
|