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!
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

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!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,686
Members
412,481
Latest member
nhantam
Top