![]() |
Copy 1-4 sheets to a new workbook
Hi,
I have a problem finding out how to copy 4 sheets (mymaster.xls) to another workbook (newWB.xls), the 4 sheets should have the rowheights and formats also copied to the new workbook, another problem is that the master.xls have alot of commandbuttons and other code that i dont want in the newWB. The area that i want copied in every worksheet is A1-S34 in that area there is now commandbuttons. I really hope that there is someone who can help me. thanks, Ole |
Copy 1-4 sheets to a new workbook
This will get you started:
http://www.officearticles.com/excel/...ft_excel .htm You can then select the command buttons with a right-click, or by using your selection tool on the Drawing toolbar. Right-click the sheet tab and choose View Code. Delete all the code in the code window at right. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "ole_" wrote in message ... Hi, I have a problem finding out how to copy 4 sheets (mymaster.xls) to another workbook (newWB.xls), the 4 sheets should have the rowheights and formats also copied to the new workbook, another problem is that the master.xls have alot of commandbuttons and other code that i dont want in the newWB. The area that i want copied in every worksheet is A1-S34 in that area there is now commandbuttons. I really hope that there is someone who can help me. thanks, Ole |
Copy 1-4 sheets to a new workbook
Yes and no, this is actully a good idea but i dont now if you now what i
mean, all thos i want to do with a macro or commandbutton, i have tried to make one in my personal (im not sure what its called in english) and when i make the macro it works fine, here is what i do: Right-click the sheet tab and choose View Code. Delete all the code in the code window at right, i remove all the modules and then delete all the commandbuttons, then i select all the sheets and copy them to a new workbook, STOP. When i save this workbook it works perfect, but when i run the macro it works fine but dont delete the code in the sheets, it removes the modules and the commandbuttons. Here is the code: Sub deleteallcode3() ' ' deleteallcode3 Makro ' Makro indspillet 30-06-2005 af Ole ' ' Sheets("Ark2").Select ActiveSheet.Shapes("CommandButton1").Select Selection.Delete Sheets("Ark3").Select ActiveSheet.Shapes.Range(Array("CommandButton1", "CommandButton2")).Select Selection.Delete Sheets("Ark4").Select ActiveSheet.Shapes.Range(Array("CommandButton1", "CommandButton2")).Select Selection.Delete Sheets(Array("Ark1", "Ark2", "Ark3", "Ark4")).Select Sheets("Ark1").Activate Sheets(Array("Ark1", "Ark2", "Ark3", "Ark4")).Copy End Sub Any ideas Ole "Anne Troy" skrev i en meddelelse news:ec7ff$42c39b5b$97c5108d$11404@allthenewsgroup s.com... This will get you started: http://www.officearticles.com/excel/...kbook_in_micro soft_excel.htm You can then select the command buttons with a right-click, or by using your selection tool on the Drawing toolbar. Right-click the sheet tab and choose View Code. Delete all the code in the code window at right. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "ole_" wrote in message ... Hi, I have a problem finding out how to copy 4 sheets (mymaster.xls) to another workbook (newWB.xls), the 4 sheets should have the rowheights and formats also copied to the new workbook, another problem is that the master.xls have alot of commandbuttons and other code that i dont want in the newWB. The area that i want copied in every worksheet is A1-S34 in that area there is now commandbuttons. I really hope that there is someone who can help me. thanks, Ole |
Copy 1-4 sheets to a new workbook
Try using this to delete the code module, assuming it is a standard code
module Dim vbMod As Object Set vbMod = ActiveWorkbook.VBProject.VBComponents("Module1") ThisWorkbook.VBProject.VBComponents.Remove vbMod -- HTH Bob Phillips "ole_" wrote in message ... Yes and no, this is actully a good idea but i dont now if you now what i mean, all thos i want to do with a macro or commandbutton, i have tried to make one in my personal (im not sure what its called in english) and when i make the macro it works fine, here is what i do: Right-click the sheet tab and choose View Code. Delete all the code in the code window at right, i remove all the modules and then delete all the commandbuttons, then i select all the sheets and copy them to a new workbook, STOP. When i save this workbook it works perfect, but when i run the macro it works fine but dont delete the code in the sheets, it removes the modules and the commandbuttons. Here is the code: Sub deleteallcode3() ' ' deleteallcode3 Makro ' Makro indspillet 30-06-2005 af Ole ' ' Sheets("Ark2").Select ActiveSheet.Shapes("CommandButton1").Select Selection.Delete Sheets("Ark3").Select ActiveSheet.Shapes.Range(Array("CommandButton1", "CommandButton2")).Select Selection.Delete Sheets("Ark4").Select ActiveSheet.Shapes.Range(Array("CommandButton1", "CommandButton2")).Select Selection.Delete Sheets(Array("Ark1", "Ark2", "Ark3", "Ark4")).Select Sheets("Ark1").Activate Sheets(Array("Ark1", "Ark2", "Ark3", "Ark4")).Copy End Sub Any ideas Ole "Anne Troy" skrev i en meddelelse news:ec7ff$42c39b5b$97c5108d$11404@allthenewsgroup s.com... This will get you started: http://www.officearticles.com/excel/...kbook_in_micro soft_excel.htm You can then select the command buttons with a right-click, or by using your selection tool on the Drawing toolbar. Right-click the sheet tab and choose View Code. Delete all the code in the code window at right. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "ole_" wrote in message ... Hi, I have a problem finding out how to copy 4 sheets (mymaster.xls) to another workbook (newWB.xls), the 4 sheets should have the rowheights and formats also copied to the new workbook, another problem is that the master.xls have alot of commandbuttons and other code that i dont want in the newWB. The area that i want copied in every worksheet is A1-S34 in that area there is now commandbuttons. I really hope that there is someone who can help me. thanks, Ole |
All times are GMT +1. The time now is 07:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com