|
Sub 批量打印()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("打印模板")
r = .Cells(Rows.Count, 2).End(xlUp).Row
ar = .Range("b2:b" & r)
For i = 3 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
d(Trim(ar(i, 1))) = ""
End If
Next i
For Each k In d.keys
.AutoFilterMode = False
.Rows(2).AutoFilter
.Range("a2:i" & r).AutoFilter Field:=2, Criteria1:=k, Operator:=xlAnd
.PrintOut
Next k
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|