Help with macro for copying sheet to existing workbook

patrick200

New Member
Joined
Jan 14, 2013
Messages
21
Hi all
I'm trying to copy one sheet and insert it to another existing workbook (storing it for future reference)..... It will copy the sheet but it also copies over the other sheets already in the workbook..........I have no idea what I've done wrong

I'm using Excel 2010 on Windows7

here's the code I have so far

Sub Sample()
Workbooks.Open Filename:=("C:\Users\laptop\Desktop\SAVEDSCHEDULE.xlsx")
Windows("Test Schedule - Copy.xlsm").Activate
Sheets("Sheet3").Select
Sheets("Sheet3").Copy Before:=Workbooks("SAVEDSCHEDULE.xlsx").Sheets(1)
Application.DisplayAlerts = False
Workbooks("SAVEDSCHEDULE.xlsx").SaveAs "C:\Users\laptop\Desktop\SAVEDSCHEDULE.xlsx"
Application.DisplayAlerts = True
Workbooks("SAVEDSCHEDULE.xlsx").Close
End Sub


Thanks.......Pat
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
There's nothing in the code that would copy more than Sheet3 that I can see. Have you tried stepping through the code (press F8 key repeatedly) to see what's happening? Have you checked to see that you have not grouped all the sheets when the code is run?
 
Upvote 0
There's nothing in the code that would copy more than Sheet3 that I can see. Have you tried stepping through the code (press F8 key repeatedly) to see what's happening? Have you checked to see that you have not grouped all the sheets when the code is run?

Hi there.....Thanks for the reply
Thats actually what I want to do......Copy sheet3 and save it in another workbook...then, as "data" is changed in the original sheet3....I want to save a new copy of sheet3 in front of the old in the other workbook.......I hope this makes sense.......but as I save a new sheet3 to the other workbook the sheet3 that was previously saved changes to the new sheet3.........It's actally very odd.....I have no idea how to correct it.


Thanks...Pat
 
Upvote 0
Hi there.....Thanks for the reply
Thats actually what I want to do......Copy sheet3 and save it in another workbook...then, as "data" is changed in the original sheet3....I want to save a new copy of sheet3 in front of the old in the other workbook.......I hope this makes sense.......but as I save a new sheet3 to the other workbook the sheet3 that was previously saved changes to the new sheet3.........It's actally very odd.....I have no idea how to correct it.


Thanks...Pat
You can't copy a sheet to a workbook that has the same name as an existing sheet in that workbook.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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
Back
Top