View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Group worksheets

Like Jim I am not really too sure what you are trying to do but I can offer a
slightly more elegant way to select the sheets. You can adapt as required.

Hope useful.

Dim ShArr() As String
'Create an Array
'of all Sheets
Dim sh As Long
With ThisWorkbook.Worksheets
ReDim ShArr(1 To .Count)
For sh = 1 To .Count
ShArr(sh) = .Item(sh).Name
Next sh
End With
Worksheets(ShArr).Select
--
jb


"Fred" wrote:

Hi
I'm trying to group worksheets, and not having much luck. I have tried this
with and without arrays. I am using the sheet code names, not the tab names,
and this is when I started having problems. The tab names worked until
different tab names occured. Where am I going wrong?

With MyBook
Sheets(array("Sheet13", "Sheet14", "Sheet15", "Sheet16", "Sheet17",
"Sheet18", "Sheet19", "Sheet20", "Sheet21", "Sheet22", "Sheet23",
"Sheet24")).Select
Sheets("sheet13").Activate
Call UpdateVlookup
Sheets("Sheet1").Activate
Sheets("Sheet16").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End With

Thanks for your help
Fred