|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets(1).UsedRange
- For i = 3 To UBound(arr)
- d(arr(i, 1)) = i
- Next
- k = d.keys
- For i = 0 To UBound(k)
- Sheets(1).Range(Cells(2, 2), Cells(UBound(arr), UBound(arr, 2))).AutoFilter Field:=1, Criteria1:=k(i)
- With ActiveSheet.PageSetup
- .PrintTitleRows = "$1:$2"
- .PrintTitleColumns = ""
- .Orientation = xlLandscape
- .Zoom = False
- .FitToPagesWide = 1
- .FitToPagesTall = False
- ActiveSheet.PrintOut
- End With
- Next
- End Sub
复制代码 尝试写了个,你试试。
|
|