View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default Loading Sheets into a Customer Collection

I have a custom collection called Myworksheets. I want to load a certain
sheets into this collection. The syntax below works. I have two questions:

1) Can someone explain the syntax to me. Not sure what the difference is
between the sheet name in the bracket and the sheet name outside the bracket.

2) This assumes I know the names of the sheets. What if the sheet names
were loaded into a listbox. How would I adjust the code to loop through the
list box and load the sheets into my custom collection.

With MyWorksheets
.Add ThisWorkbook.Worksheets("Sheet1"), "Sheet1"
.Add ThisWorkbook.Worksheets("Sheet4"), "Sheet4"
End With

Thanks

EM