+ Reply to Thread
Results 1 to 4 of 4

copy a command button to new worksheet

  1. #1
    elaine
    Guest

    copy a command button to new worksheet

    Hello,

    Does anyone knows how to copy a command button to new worksheet?

    I am a beginner and want to do things more effective, cos I have to
    fill in different information in the same template but split across the
    sheet.

    eg.

    I create a template in Sheet A and I have asign a macro (to copy the
    whole sheet and insert a new sheet) to a command button.

    Private Sub test()
    Cells.Select
    Selection.Copy
    Sheets("Sheet1").Select
    Sheets.Add
    ActiveSheet.Paste
    End Sub

    When I click on that command button in sheet A, it will copy the whole
    sheet A to a new sheet.

    However the command button is not on the new sheet. (but still)

    Is there a way to copy and paste the command button too, so that there
    will always be a command button in the new sheet?

    Thanks.

    Elaine.


  2. #2
    Norman Jones
    Guest

    Re: copy a command button to new worksheet

    Hi Elaine,

    Try:

    '=============>>
    Public Sub Test()
    Sheets("SheetA").Copy After:=Sheets(Sheets.Count)
    End Sub
    '<<=============



    ---
    Regards,
    Norman



    "elaine" <elaine216@gmail.com> wrote in message
    news:1150987972.065032.16710@y41g2000cwy.googlegroups.com...
    > Hello,
    >
    > Does anyone knows how to copy a command button to new worksheet?
    >
    > I am a beginner and want to do things more effective, cos I have to
    > fill in different information in the same template but split across the
    > sheet.
    >
    > eg.
    >
    > I create a template in Sheet A and I have asign a macro (to copy the
    > whole sheet and insert a new sheet) to a command button.
    >
    > Private Sub test()
    > Cells.Select
    > Selection.Copy
    > Sheets("Sheet1").Select
    > Sheets.Add
    > ActiveSheet.Paste
    > End Sub
    >
    > When I click on that command button in sheet A, it will copy the whole
    > sheet A to a new sheet.
    >
    > However the command button is not on the new sheet. (but still)
    >
    > Is there a way to copy and paste the command button too, so that there
    > will always be a command button in the new sheet?
    >
    > Thanks.
    >
    > Elaine.
    >




  3. #3
    Piotr Lipski
    Guest

    Re: copy a command button to new worksheet

    On 22 Jun 2006 07:52:52 -0700, elaine wrote:

    [..].
    > I create a template in Sheet A and I have asign a macro (to copy the
    > whole sheet and insert a new sheet) to a command button.

    [...]
    > Is there a way to copy and paste the command button too, so that there
    > will always be a command button in the new sheet?


    Can't you just use the same button again?
    Copying a button requires copying associated VBA code as well. This is
    quite bad idea.

    If you need some universal button (available all the time, on every sheet),
    try to put it on a user form, not on a sheet.

    --
    PL

  4. #4
    Norman Jones
    Guest

    Re: copy a command button to new worksheet

    Hi Piotor,

    Given Elaine's shown macro and the phrase "and I have asign a macro", I
    assume that the button in question is a Forms button.

    ---
    Regards,
    Norman



    "Piotr Lipski" <piotr.lipski@nie.p0czta.spamuj.bo.onet.w.ryj.pl> wrote in
    message news:1cij5ptc6lppd.18yhae3sqbesv.dlg@40tude.net...
    > On 22 Jun 2006 07:52:52 -0700, elaine wrote:
    >
    > [..].
    >> I create a template in Sheet A and I have asign a macro (to copy the
    >> whole sheet and insert a new sheet) to a command button.

    > [...]
    >> Is there a way to copy and paste the command button too, so that there
    >> will always be a command button in the new sheet?

    >
    > Can't you just use the same button again?
    > Copying a button requires copying associated VBA code as well. This is
    > quite bad idea.
    >
    > If you need some universal button (available all the time, on every
    > sheet),
    > try to put it on a user form, not on a sheet.
    >
    > --
    > PL




+ 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