Results 1 to 9 of 9

Exclude printing a specific worksheet in a workbook

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Exclude printing a specific worksheet in a workbook

    Hi

    I use the following macro to print pages with data but, have added another worksheet that is filled with data that I do not wish to print. Can you help please with how I exclude a worksheet called Time Calc?

    Dim sht As Integer
    Sub Conditional_Print()
    'this will work from any sheet
        Dim rRng As Range
        Dim rCl As Range
        sht = 0
        Set rRng = Worksheets("Machine logo costs").Range("K66:K74")
        For Each rCl In rRng
            sht = sht + 1
            PrintSht (rCl.Value)
        Next rCl
    End Sub
    Sub PrintSht(OK As Boolean)
    'don't print empty sheets
        On Error Resume Next
        If WorksheetFunction.CountA(Worksheets(sht).Cells) = 0 Then OK = False
        If OK = True Then Worksheets(sht).PrintOut
    exit_proc:
        On Error GoTo 0
    End Sub
    Last edited by Steven811; 08-28-2012 at 12:19 PM. Reason: No tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1