ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   prevent print (https://www.excelbanter.com/excel-programming/439444-prevent-print.html)

joemeshuggah

prevent print
 
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


Mike H

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



All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com