View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default add worksheet to group

Hi Rich,

Here is some sample code to group the sheets, just change the criteria to
yours

Dim i As Long, j As Long
Dim arySheets

For i = 1 To Worksheets.Count
If Left(Worksheets(i).Name, 5) = "Sheet" Then
If j = 0 Then
ReDim arySheets(0)
Else
ReDim Preserve arySheets(j)
End If
arySheets(j) = Worksheets(i).Name
j = j + 1
End If
Next i

Worksheets(arySheets).Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Rich" wrote in message
...
I am looking for a way to add a worksheet to a group of
sheets that I will print using the "printpreview" method.

I will add them if they meet certain requirements, which
I've already worked out.

I'm just looking for the method and an example to add the
sheets to the group.