PC Review


Reply
Thread Tools Rate Thread

Copy to end of sheets, another file

 
 
Inkmuser
Guest
Posts: n/a
 
      18th Jun 2009
I cannot get this working right. Trying to copy sheet from active (open) file
over to another, also open, file...but at the end of the sheets in the target
file. Sheet count in the target file will be constantly changing. Current
code:

ActiveSheet.Copy After:=Workbooks( _
"PPSurveys-Master.xls").Worksheets(Worksheets.Count)

Result is the sheet is copied to the external file...but inserted after the
first tab, not at the end.

Have tried Sheets(Sheets.Count), ActiveWorksheet(ActiveWorksheet.Count) and
other approaches, but it always copies (or moves) into the second position,
never after the desired last tab!

Any ideas?
 
Reply With Quote
 
 
 
 
Inkmuser
Guest
Posts: n/a
 
      19th Jun 2009
Thanks! That did the trick...
Gary

"Norie" wrote:

> Your Worksheets.Count doesn't have a workbook reference so will refer to the
> worksheets in the active workbook.
>
> With Workbooks("PPSurveys-Master.xls")
> ActiveSheet.Copy After:= .Worksheets(.Worksheets.Count)
> End With
>
>
> "Inkmuser" <(E-Mail Removed)> wrote in message
> news:F91503E8-295C-4CB3-B99F-(E-Mail Removed)...
> >I cannot get this working right. Trying to copy sheet from active (open)
> >file
> > over to another, also open, file...but at the end of the sheets in the
> > target
> > file. Sheet count in the target file will be constantly changing. Current
> > code:
> >
> > ActiveSheet.Copy After:=Workbooks( _
> > "PPSurveys-Master.xls").Worksheets(Worksheets.Count)
> >
> > Result is the sheet is copied to the external file...but inserted after
> > the
> > first tab, not at the end.
> >
> > Have tried Sheets(Sheets.Count), ActiveWorksheet(ActiveWorksheet.Count)
> > and
> > other approaches, but it always copies (or moves) into the second
> > position,
> > never after the desired last tab!
> >
> > Any ideas?

>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Copy to end of sheets, another file Norie Microsoft Excel Programming 0 18th Jun 2009 09:38 PM
Copy Visible Sheets to New File =?Utf-8?B?VHJvdWJsZWQgVXNlcg==?= Microsoft Excel Programming 3 9th Sep 2007 10:26 PM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file attis555@hotmail.com Microsoft Excel Setup 0 14th Mar 2007 02:13 AM
in VBA Sheets("mysheet").Copy Before:=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Microsoft Excel Discussion 1 6th Jul 2005 10:05 PM
copy sheets to another file Gareth Microsoft Excel Programming 2 18th Oct 2003 05:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:19 AM.