zoom38
08-08-2014, 12:01 PM
I have the following code that counts the worksheets that have with the name beginning with "204".
Dim ppWorksheets As Variant
Dim Count As Long
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(Left(WS.Name, 3), "204", vbTextCompare) = 0 Then
Count = Count + 1
End If
Next WS
I have the following code that is used to send the sheets that I want to Print Preview.
ppWorksheets = Array("Cover", "Agenda", "202", "203", "204", "204 (2)", "204 (3)", "205", "206")
ThisWorkbook.Worksheets(ppWorksheets).PrintPreview
On Error Resume Next
In the print array I have to specify the sheets by name. Is there a way to combine the code above so that I don't have to specify the sheet names? Keep in mind that I am not printing all of the sheets in the workbook. I'm trying to do this because the number of "204" sheets will vary and I like the print array so I can use the print preview for multiple sheets but not all of the sheets.
Thanks
Gary
Dim ppWorksheets As Variant
Dim Count As Long
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(Left(WS.Name, 3), "204", vbTextCompare) = 0 Then
Count = Count + 1
End If
Next WS
I have the following code that is used to send the sheets that I want to Print Preview.
ppWorksheets = Array("Cover", "Agenda", "202", "203", "204", "204 (2)", "204 (3)", "205", "206")
ThisWorkbook.Worksheets(ppWorksheets).PrintPreview
On Error Resume Next
In the print array I have to specify the sheets by name. Is there a way to combine the code above so that I don't have to specify the sheet names? Keep in mind that I am not printing all of the sheets in the workbook. I'm trying to do this because the number of "204" sheets will vary and I like the print array so I can use the print preview for multiple sheets but not all of the sheets.
Thanks
Gary