2009-11-05 61 views

回答

2
Sub PrintSheets() 
    Dim cell As Range 
    For Each cell In Sheet1.Range("A1:A10") '''(change this) 
    If cell.Offset(0, 1).Value <> "" Then 
     Sheets(cell.Value).PrintOut 
    End If 
    Next cell 
End Sub 
1

如何使用紙張的屬性來選擇要打印的紙張。

像標籤顏色 - 易於設置和一個很好的視覺指標。

Sub PrintSheets() 
     Dim sb As String 
     sb = Application.StatusBar 
     If sb = "False" Then sb = "" 

     Dim ws As Worksheet 
     For Each ws In ActiveWorkbook.Worksheets 
      If 0 < ws.Tab.ColorIndex Then 
       Application.StatusBar = "Printing " & ws.Name & " ..." 
       ws.PrintOut 
      End If 
     Next 

     Application.StatusBar = sb 
End Sub