View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copying multiple worksheets into a new workbook


wbk2.Worksheets(wbk2.worksheet.count)

would be the way to refer to the last worksheet in wbk2

another problem would be if Datasheet does not contain a valid sheetname
for the activeworkbook

--
Regards,
Tom Ogilvy


"anhjan " wrote in message
...
Thanks guys for the suggestions, however, I'm still getting stuck after
copying the first sheet to the new workbook. The error I get is that
it is a "Runtime error '9'; Subscript is out of range" and it
hightlights:

Sheets(DataSheet).COPY After:=wbk2.Worksheet.Count


Any other suggestions...


---
Message posted from http://www.ExcelForum.com/