PC Review


Reply
Thread Tools Rate Thread

Copy/Paste Worksheet to End of Workbook

 
 
=?Utf-8?B?REJhdmlyc2hh?=
Guest
Posts: n/a
 
      15th Aug 2007
I have the following code written in a macro:

Application.Goto Reference:="'Worksheet A'!RC"
Sheets("Worksheet A").Copy After:=Sheets(5)

What I really want to do is copy 'Worksheet A' after the last worksheet in
my workbook regardless of how many worksheets there are in the workbook, and
NOT always after Sheet 5.

Thanks for your help.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?cmVrbGFtbw==?=
Guest
Posts: n/a
 
      15th Aug 2007
Try following code:

Application.Goto Reference:="'Worksheet A'!RC"
Sheets("Worksheet A").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)



Regards
reklamo



"DBavirsha" wrote:

> I have the following code written in a macro:
>
> Application.Goto Reference:="'Worksheet A'!RC"
> Sheets("Worksheet A").Copy After:=Sheets(5)
>
> What I really want to do is copy 'Worksheet A' after the last worksheet in
> my workbook regardless of how many worksheets there are in the workbook, and
> NOT always after Sheet 5.
>
> Thanks for your help.

 
Reply With Quote
 
=?Utf-8?B?REJhdmlyc2hh?=
Guest
Posts: n/a
 
      15th Aug 2007
Worked like a charm. Thanks for your quick help!!

Dave

"reklamo" wrote:

> Try following code:
>
> Application.Goto Reference:="'Worksheet A'!RC"
> Sheets("Worksheet A").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
>
>
>
> Regards
> reklamo
>
>
>
> "DBavirsha" wrote:
>
> > I have the following code written in a macro:
> >
> > Application.Goto Reference:="'Worksheet A'!RC"
> > Sheets("Worksheet A").Copy After:=Sheets(5)
> >
> > What I really want to do is copy 'Worksheet A' after the last worksheet in
> > my workbook regardless of how many worksheets there are in the workbook, and
> > NOT always after Sheet 5.
> >
> > Thanks for your help.

 
Reply With Quote
 
=?Utf-8?B?S2VpdGhsbw==?=
Guest
Posts: n/a
 
      15th Aug 2007
Try this:

Dim MySheetIndex
MySheetIndex = 1
For Each Sheet In Worksheets
If Sheet.Index > MySheetIndex Then
MySheetIndex = Sheet.Index
End If
Next Sheet

Application.Goto Reference:="'Worksheet A'!RC"
Sheets("Worksheet A").Copy After:=Sheets(MySheetIndex)

Hope this helps,

Keith


"DBavirsha" wrote:

> I have the following code written in a macro:
>
> Application.Goto Reference:="'Worksheet A'!RC"
> Sheets("Worksheet A").Copy After:=Sheets(5)
>
> What I really want to do is copy 'Worksheet A' after the last worksheet in
> my workbook regardless of how many worksheets there are in the workbook, and
> NOT always after Sheet 5.
>
> Thanks for your help.

 
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
Copy worksheet, trying to paste to new workbook error assistance. fishy Microsoft Excel Programming 1 6th May 2010 03:16 PM
copy and paste whole worksheet from one workbook to another Allen the Computer Guy Microsoft Excel Programming 3 29th Dec 2009 10:06 PM
Copy and Paste Chart as Picture into another workbook or worksheet =?Utf-8?B?U3RldmVD?= Microsoft Excel Charting 1 15th Feb 2007 11:47 PM
copy data from one worksheet and paste into another workbook =?Utf-8?B?TWlrZSBSLg==?= Microsoft Excel Programming 1 21st Dec 2004 07:35 AM
Copy and paste the worksheet to New workbook.. Sudarshan Microsoft Excel Programming 1 26th May 2004 06:51 PM


Features
 

Advertising
 

Newsgroups
 


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