|
Sub 导出资料()
Application.ScreenUpdating = False
Dim Fs$, MyP$, Wb As Workbook, k
Dim arr As Variant
Dim br()
With ActiveSheet
b = .[a65536].End(xlUp).Row
arr = .Range("a3:e" & b)
End With
ReDim br(1 To UBound(arr), 1 To UBound(arr, 2))
For i = 1 To UBound(arr)
n = n + 1
br(n, 1) = arr(i, 5)
br(n, 2) = arr(i, 3)
br(n, 3) = arr(i, 4)
br(n, 4) = arr(i, 1)
br(n, 5) = arr(i, 2)
Next i
MyP = ThisWorkbook.Path & "\"
Fs = Dir(MyP & "粤海" & [C1] & "年汇总表.xls")
If Fs = "" Then MsgBox "找不到" & "粤海" & [C1] & "年汇总单.xls": End
Set Wb = Workbooks.Open(MyP & Fs)
With Wb.Sheets("1月份")
.UsedRange.Borders.LineStyle = 0
.UsedRange = Empty
.Range("a3").Resize(n, UBound(br, 2)) = br
.Range("a3").Resize(n, UBound(br, 2)).Borders.LineStyle = 1
End With
Wb.Close savechanges:=True
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|