|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
把模版直接放在数据文件里
- Sub test()
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim arr, i&, j&, r&
- With Sheet1
- r = .Cells.Find("*", Cells(1, 1), xlValues, xlWhole, xlByRows, xlPrevious).Row
- arr = .Range("A1:E" & r)
- End With
- For i = 3 To UBound(arr)
- If Len(arr(i, 2)) Then
- With Sheets("封面")
- .[b3] = arr(i, 3)
- .[b4] = arr(i, 2)
- End With
- With Sheets("统计表")
- .[b1] = arr(i, 3)
- .[b2] = arr(i, 2)
- End With
- Sheets(Array("封面", "统计表")).Copy
- ActiveWorkbook.SaveAs ThisWorkbook.Path & "\员工产能-" & arr(i, 3) & arr(i, 2), xlExcel8
- ActiveWorkbook.Close
- End If
- Next i
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码 |
|