Macro to Copy Active Worksheet to End of Workbook

swampgirl

New Member
Joined
Nov 15, 2005
Messages
5
I've resisted posting for help on this, but after about the hundredth attempt and way too many hours searching the web for the code, I admit defeat.

All I want to do is create a macro that will copy the active worksheet (whichever it may be at that moment, although usually it will already be the last one) to the end of the workbook. I've tried relative references, monkeying with the VB script (unfortunately I don't go much further than the original BASIC in days of yore.... 10 PRINT "Hello!"), and at this point am tempted to give voodoo a whirl. I always end up with either the same sheet being copied no matter what is active, or one that isn't copied to the end of the workbook.

Help? Please please pretty please? Proverbial cherry on top and everything?

Thanks so much!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

dtchan

Board Regular
Joined
Aug 8, 2005
Messages
108
Try this code:
put it in a module

Public Sub MoveActiveSheetToEndOfWorkbook()

Dim wksCurrent As Worksheet
Dim wksLast As Worksheet

For Each wksCurrent In Worksheets

Set wksLast = wksCurrent

Next wksCurrent

ActiveSheet.Move , wksLast
End Sub
 

swampgirl

New Member
Joined
Nov 15, 2005
Messages
5
Hi...I appreciate your time and help! When I ran this it moved the sheet to the end of the workbook, but didn't create a copy that is moved to the end. Sorry if that wasn't completely clear in my original post....
 

swampgirl

New Member
Joined
Nov 15, 2005
Messages
5
Well nevermind....I tried changing "Move" to copy in the module you gave me and it did exactly what I wanted. YAYY!!!

Thanks so much dtchan!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,805
Messages
5,833,773
Members
430,232
Latest member
Testsubject

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top