+ Reply to Thread
Results 1 to 7 of 7

How to copy "command button" to another sheet

  1. #1
    Registered User
    Join Date
    01-14-2004
    Posts
    22

    How to copy "command button" to another sheet

    I have a worksheet containing "command button" and some other data. When I made copy form one sheet to another, it only pasted data in anohter sheet. So, how do i copy the command button and data to another sheet?

    TIA

    norika

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    I am not sure if you need a macroto do this or not:
    But you can do this manually by:
    Open the control toolbox menu and click on design mode to enter design mode.

    Ctrl-A to select all on the source sheet
    Ctrl-C to Copy
    Select sheet to paste too
    Ctrl-V to paste

    You will have to also copy the code across (in Vbeditor) for the command button as this does not copy.

  3. #3
    Registered User
    Join Date
    01-14-2004
    Posts
    22
    There is vba behind the command button.
    eg copy from 'sheet 1' (having command button and vba) to 'sheet 2'. After copying, it does not any vba behind command button in sheet.

    the code in sheet 1:
    Private Sub GoToSheet1()
    Sheets("Sheets 10").select
    ...
    End sub

    TIA
    norika

  4. #4
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    If you copy the whole sheet by clicking on the sheet tab and making a copy to a new sheet it copies the code as well ...HTH
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  5. #5
    Registered User
    Join Date
    01-31-2015
    Location
    USA
    MS-Off Ver
    2007
    Posts
    2

    Re: How to copy "command button" to another sheet

    Quote Originally Posted by stevebriz View Post
    If you copy the whole sheet by clicking on the sheet tab and making a copy to a new sheet it copies the code as well ...HTH
    actually, i did this as that's how i'm used to copying my entire spreadsheets (including control objects such as "buttons" -- since excel 2000). however, the workbook was originally created in excel 2003 and we just recently updated to 2007. now, when i copied my old worksheet to create another tab in the workbook, all the text/formulas copied over, but the button did not. i then went back to the original sheet, made sure that both worksheets were unprotected, went into the developer tab clicked on "design mode" so that i could select the button, "copied" the button, selected the new spreadsheet, and tried to paste the button onto the spreadsheet (i tried the copy/paste several different ways). i get an error dialog from excel stating:
    _________________________________________
    "Microsoft Office Excel cannot paste the data."
    <OK>
    _________________________________________

    i'm so used to the simple process of right-clicking on the TAB, selecting copy worksheet and position in the workbook and everything gets copied. as i do this a lot, i would really appreciate knowing if there's some setting in excel that was turned off that i could fix so that i can get this valuable feature back.

    thanks,
    ee
    Last edited by engine2345; 01-31-2015 at 12:53 PM.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to copy "command button" to another sheet

    Are these ActiveX controls or are they from the Forms menu?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    01-31-2015
    Location
    USA
    MS-Off Ver
    2007
    Posts
    2

    Re: How to copy "command button" to another sheet

    thanks for the quick reply!

    this is a button from the forms toolbar. i did make some progress, however. after i saved out the spreadsheet in the updated new .XLSM format, the button is now able to be copied over with the spreadsheet, but the macro that is assigned to the original sheet is no longer assigned to this button. had to manually re-assign the macro (which i never had to do in excel 2000 or 2003).

+ 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