Thread: prevent print
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default prevent print

Hi,

Try it this way

Dim WS As Worksheet
S = "ResultDetail,ControlDetail,ResultDetail"
V = Split(S, ",")
For Each WS In ThisWorkbook.Worksheets
If IsError(Application.Match(CStr(WS.name), V, 0)) Then
WS.PrintOut
End If
Next

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"joemeshuggah" wrote:

i am using the following piece of code to prevent the printing of a few
specified tabs in a workbook, however, it does not appear to be working
correctly. where am i going wrong? using excel 2003

For Each Sheet In ThisWorkbook
If Sheet.Name < "TestData" And Sheet.Name < "ResultDetail" And
Sheet.Name < "ControlDetail" Then
Sheet.PrintOut
End If
Next