- 帖子
- 552
- 主題
- 3
- 精華
- 0
- 積分
- 578
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2010
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2015-2-8
- 最後登錄
- 2024-7-9
  
|
3#
發表於 2016-4-24 20:18
| 只看該作者
回復 1# starry1314
也可以這樣!- Option Explicit
- Sub 巨集1()
- Dim c As Range
- With Sheets("工作表1")
- Set c = .Rows(3).Find("P.P", , , , , 1) '往後尋找
- .PageSetup.PrintArea = .Range(.Cells(Rows.Count, 1).End(xlUp), Cells(2, c.Column)).Address '設定列印範圍
- .PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False '列印
- Set c = Nothing
- Set c = .Rows(3).Find("P.P", , , , , 2) '往前尋找
- .PageSetup.PrintArea = .Range(.Cells(Rows.Count, 1).End(xlUp), Cells(2, c.Column)).Address '設定列印範圍
- .PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False '列印
- Set c = Nothing
- End With
- End Sub
複製代碼 |
|