+ Reply to Thread
Results 1 to 4 of 4

Copy 1-4 sheets to a new workbook

  1. #1
    ole_
    Guest

    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



  2. #2
    Anne Troy
    Guest

    Re: Copy 1-4 sheets to a new workbook

    This will get you started:
    http://www.officearticles.com/excel/...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_" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >
    >




  3. #3
    ole_
    Guest

    Re: 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" <[email protected]> skrev i en meddelelse
    news:[email protected]...
    > 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_" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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
    > >
    > >

    >
    >




  4. #4
    Bob Phillips
    Guest

    Re: 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_" <[email protected]> wrote in message
    news:[email protected]...
    > 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" <[email protected]> skrev i en meddelelse
    > news:[email protected]...
    > > 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_" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1