|
代码如下,,,
Sub test()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
t = Timer
Dim wb As Workbook, sht As Worksheet, sh As Worksheet
Set wb = ThisWorkbook
Set sht = wb.Sheets("打印")
arr = sht.[a1].CurrentRegion
Application.Dialogs(9).Show '此处为选择打印机,无需要可以删除
For i = 2 To UBound(arr)
If arr(i, 3) <> Empty Then
On Error Resume Next '没有的工作表出错
wb.Sheets(arr(i, 2)).PageSetup.PrintArea = wb.Sheets(arr(i, 2)).UsedRange.Address
wb.Sheets(arr(i, 2)).PrintOut copies:=arr(i, 3)
End If
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "共耗时:" & Format(Timer - t, "0.0000") & " 秒!!!", 64
End Sub
|
评分
-
1
查看全部评分
-
|