|
- Sub zz()
- Dim d As Object, k, rng As Range
- Application.ScreenUpdating = 0
- Set d = CreateObject("scripting.dictionary")
- ActiveSheet.AutoFilterMode = 0
- Set rng = [a3].CurrentRegion
- a = rng.Value
- For i = 2 To UBound(a)
- d(a(i, 4)) = ""
- Next
- k = d.keys
- Workbooks.Add 1
- rng.Copy [a3]
- Call ss(k(0))
- For i = 1 To UBound(k)
- Sheets.Add After:=Sheets(Sheets.Count)
- rng.Copy [a3]
- Call ss(k(i))
- Next
- With Application.FileDialog(msoFileDialogSaveAs)
- .FilterIndex = 21
- .Show
- If .SelectedItems.Count Then
- fn = .SelectedItems(1)
- ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fn, _
- Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
- :=False, OpenAfterPublish:=False
- ActiveWorkbook.Close 0
- Else
- Exit Sub
- End If
- End With
- Application.ScreenUpdating = 1
- End Sub
复制代码
- Sub ss(k)
- With ActiveSheet.[a3].CurrentRegion
- .AutoFilter Field:=3, Criteria1:="<>"
- .AutoFilter Field:=4, Criteria1:=k
- End With
- End Sub
复制代码 |
|