+ Reply to Thread
Results 1 to 24 of 24

Copying a sheet without copying the command buttons

  1. #1
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Copying a sheet without copying the command buttons

    I have a macro that makes a copy of a sheet, changes the name of the workbook and closes. When it copies it includes the 4 command buttons that are on that sheet. How can I copy the sheet and note the command buttons? I have tried changing the properties to don't move, but to no avail they CB still copy.

    Please Login or Register  to view this content.
    Thanks for the help.

    LeapingLizard
    Last edited by LeapingLizard; 10-26-2012 at 10:44 AM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Copying a sheet without copying the command buttons

    I just add a command to delete them from the copied sheet. It would be easier than copying ranges, formulas, etc.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Is there a way to delete them after the sheet is copied?

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    Hi LeapingLizard,

    Replace your Code with this:

    Please Login or Register  to view this content.
    Hope that helps.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Thanks Winon for trying, but it did not change anything. I even tried putting ( ActiveSheet.DrawingObjects.Delete) after I copied and before I saved it and that did not work.
    I am open to try anything else if there are any other suggestions.

    Thanks all,

    LeapingLizard

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    Hi LeapingLizard,

    In your first post you ask:

    How can I copy the sheet and not the command buttons?
    The Code I have supplied you with, works fine on my side regarding the Buttons. Do they still show when you copy the Sheet?

    If that is the case, you are most likely using Active X Command Buttons and not Form Buttons, in which case the Code will have to be adjusted.

    Can you not maybe, upload a sample WorkBook for us to have a look at?

  7. #7
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Thanks Winon,

    I have solved it. Here is the code I used;
    Please Login or Register  to view this content.
    Thanks,

    LeapingLizard

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    Hello LeapingLizard,

    Well, that explains everything!

    There is a BIG difference between a Button and a Shape to which you assign a Macro to. You actually used a Shape of some sort with Code to appear and respond like a "Button". That is why my Code failed in your application.

    With your Code the Shapes will still be there, using Memory and increased actual file size. It is just not Visible.
    Maybe you would want to adapt your Code to rather Delete the Shape/s, instead of turning visibility to False.

  9. #9
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Hi Winon,

    Thanks for that feedback. Yes you are right I want to limit the file size, so what could I use to delete it. I am including a copy of the workbook.
    Attached Files Attached Files

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    Hello LeapingLizard,

    Add the below to your Code
    Please Login or Register  to view this content.
    See Post No.4 where the other Code for deleting of Buttons appear, remove that, and use the above instead,

  11. #11
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Thank you my friend. You are very helpful. I appreciate your knowledge.

    LeapingLizard

  12. #12
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    I was certain that that would work. but it through an object error. Any ideas?

  13. #13
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Here is where I put it and instead of an object error it gives a run-time error.
    Please Login or Register  to view this content.
    Thanks for your Help!

    LeapingLizard

  14. #14
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    Sheet is Protected,

    Try it like this:

    Please Login or Register  to view this content.
    Let me know how it goes.
    Last edited by Winon; 10-26-2012 at 04:48 PM.

  15. #15
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Sorry, no goes! It did not work.

    LeapingLizard

  16. #16
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    What is the Password of the WorkSheet?

  17. #17
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Help Template.xlsOops! I included an unprotected sheet. Maybe this will help.

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    I have removed the Password in the meantime, so check out the attached WorkBook.

    Remember to first save a Back-up copy.
    Attached Files Attached Files
    Last edited by Winon; 10-26-2012 at 11:41 PM. Reason: Corrected some Code

  19. #19
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Does anyone else have an idea as to how to delete shapes when copying to eliminate using memory as this is copied daily? Thanks!

  20. #20
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Copying a sheet without copying the command buttons

    Did @Winon example not work for you? If so, then what are the problems?

  21. #21
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copying a sheet without copying the command buttons

    @ abousetta,

    Thank you for asking that question, since everything works well on my side. Did you perhaps checked the WorkBook to see if there are any problems with Shapes maybe not deleting in the newly created WorkBook?

  22. #22
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Copying a sheet without copying the command buttons

    Hi Winon,

    The question in post #20 was really directed to @LeapingLizard since in post #19 (s)he is asking for new ideas. I think your solution works fine and that's why I am not sure what problems he is facing.

    abousetta

  23. #23
    Forum Contributor
    Join Date
    03-28-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    166

    Re: Copying a sheet without copying the command buttons

    Thanks to both of you. I have now solved it for good with your help. I certainly appreciate you guys hanging in there with me. I used Option Explicit and declared my variables and now it works swell. I will click on both your star Icons and add to your reputations. People helping people you got to love it.

    Thanks again,

    LeapingLizard

  24. #24
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Copying a sheet without copying the command buttons

    Thanks for the feedback and glad we were able to help.

    Good luck.

    abousetta

+ 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