View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Excel copy after question

After you create the new workbook, you can set an object variable to that
workbook.

Dim bk as workbook
'whatevercode you used to create that workbook
'and with that workbook the active workbook.
set bk = activeworkbook
'then lots more code
'and finally, you copy code:
bk.Worksheets(Array("Hourly Timesheets", "dates", "Time Balances")).Copy _
after:=bk.Worksheets(bk.Worksheets.Count)



ll wrote:

Hi,
I'm very new to the Excel copy after method, and I was wondering how I
would go about integrating the following code into my module. Would I
need to specify the name of the new workbook at some point within the
code? I have tried running the following code by itself in a module,
but I get the "object required" error. Any ideas? Thanks - Louis

==
bk.Worksheets(Array("Hourly Timesheets", "dates", "Time
Balances")).Copy after:=bk.Worksheets(bk.Worksheets.Count)


--

Dave Peterson