View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Moving multiple worksheets to new workbook in VBA

Assume I have two workbooks, Bk1.xls and bk2.xls, both open in excel, the
code is in Bk1.xls and I am moving worksheets(1) in bk1.xls to the end of
the tab order in bk2.xls


Workbooks("bk1.xls").Worksheets(1).Move After:= _
Workbooks("bk2.xls").Worksheets( _
Workbooks("bk2.xls").Worksheets.count)

or
With workbooks("Bk2.xls")
Workbooks("bk1.xls").Worksheets(1).Move After:= _
.Worksheets(.Worksheets.count)
End With


As you can see, it refers to a worksheet in a specific workbook.

Regards,
Tom Ogilvy


"dororke" wrote in message
...
Hi,

Yes I'm aware it does but I have tried using these to no avail. But I
believe the before and after fields actually apply to the worksheets
you want to move before/after and not the workbook.

Can you provide some sample VBA to demonstrate?

Thanks,
Dan


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