I found this on Ron DeBruins site. Works great, until I tried to modify it...
Basically I want it to print any hidden sheets that have a value in cell A600. I changed one line in the code and now get the error in the attached file on the line indicated in the code. Also added the original code so you can see the change I made
Sub Print_All_Worksheets_With_Value_In_A600()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer
N = 0
For Each Sh In ActiveWorkbook.Worksheets
If Sh.Visible = False And Sh.Range("A600").Value <> "" Then ' Original Code...If Sh.Visible = xlSheetVisible And Sh.Range("A1").Value <> "" Then
N = N + 1
ReDim Preserve Arr(1 To N)
Arr(N) = Sh.Name
End If
Next
With ActiveWorkbook
.Worksheets(Arr).PrintOut 'This is the line hilighted as the error
End With
End Sub
error.PNG
Bookmarks