View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Excel copy after question

I ran this several times
Sub Macro1()
Dim bk As Workbook
Set bk = ActiveWorkbook
bk.Worksheets(Array("Hourly Timesheets", _
"dates", "Time Balances")).Copy _
after:=bk.Worksheets(bk.Worksheets.Count)
End Sub

after I created worksheets with the names you show (or at least what the
looked like in the email)


many times, when naming a sheet, you can get an extra space somewhere in the
name, especially at the end. Make sure your sheet names are correct and
match your code.

--
Regards,
Tom Ogilvy



"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)