Copy/Paste Worksheet to End of Workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Try following code:

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



Regards
reklamo
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top