I am trying to print all sheets within a workbook without knowing the name of the tabs. I do not want the user to have to do this.
I am not sure why this doesn't work. Any ideas?
I am not sure why this doesn't work. Any ideas?
Code:
Public Sub ListPrintSheets()
' An individual entry.
Dim ThisEntry As Variant
Dim PrintArray As Variant
Dim Output As Variant
For Each ThisEntry In Application.Sheets
If Output = "" Then
Output = ThisEntry.Index
Else
Output = Output & ", " & ThisEntry.Index
End If
Next
PrintArray = Array(Output)
Sheets(PrintArray).Select
' Sheets(Array(Output)).Select
End Sub