+ Reply to Thread
Results 1 to 2 of 2

Need to Print Hidden Pages with value in a range

Hybrid View

groundin Need to Print Hidden Pages... 03-13-2013, 03:54 PM
groundin Re: Need to Print Hidden... 03-15-2013, 05:25 PM
  1. #1
    Forum Contributor
    Join Date
    11-25-2012
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    146

    Need to Print Hidden Pages with value in a range

    I Borrowed this from Ron Debruin's website, it works great but I need it to also print any sheets that are hidden with a value in A600.
    Any ideas? I tried a few changes but kept getting errors. Thanks

    Sub Print_All_Worksheets_With_Value_In_A1()
        Dim Sh As Worksheet
        Dim Arr() As String
        Dim N As Integer
        N = 0
        For Each Sh In ActiveWorkbook.Worksheets
            If Sh.Visible = xlSheetVisible And Sh.Range("A600").Value <> "" Then
                N = N + 1
                ReDim Preserve Arr(1 To N)
                Arr(N) = Sh.Name
            End If
        Next
        With ActiveWorkbook
            .Worksheets(Arr).PrintOut
        End With
    End Sub

  2. #2
    Forum Contributor
    Join Date
    11-25-2012
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    146

    Re: Need to Print Hidden Pages with value in a range

    Hi, Here is the solution that works.

    Sub Print_All_Worksheets_With_Value_In_A600()
        Dim Sh As Worksheet
        Dim Arr() As String
        Dim N As Integer
        N = 0
        Call PrintSlideSheet
        For Each Sh In ActiveWorkbook.Worksheets
            If Sh.Range("A600").Value <> "" Then
                N = N + 1
                ReDim Preserve Arr(1 To N)
                Arr(N) = Sh.Name
            End If
        Next
        With ActiveWorkbook
            For N = 1 To UBound(Arr)
    If ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetHidden Then
    ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetVisible
    ActiveWorkbook.Worksheets(Arr(N)).PrintOut
    ActiveWorkbook.Worksheets(Arr(N)).Visible = xlSheetHidden
    Else
    ActiveWorkbook.Worksheets(Arr(N)).PrintOut
    End If
    Next N
    
        End With
    End Sub

+ Reply to Thread

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