+ Reply to Thread
Results 1 to 10 of 10

Delete Buttons made from shapes when copying sheet to new workbook

  1. #1
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Delete Buttons made from shapes when copying sheet to new workbook

    Hello,

    I have a code that copies a sheet into a new workbook. The copied sheet is for information only. On the original sheet I have various macro's assigned to buttons made from using Insert Shape command. I assume if I can find away to remove the buttons then the functionality of the macro's would be lost which is what I want??

    Thanks,

    Tony.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Your current code would help...

    In the absence of - and assuming you have a reference to the copied sheet and you want to delete all shapes:
    Please Login or Register  to view this content.
    If there's nothing to call the procedures then that would do what you want - however the code will remain in the workbook unless you also save it as a XLSX file.
    Last edited by cytop; 01-27-2014 at 07:08 AM.

  3. #3
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Quote Originally Posted by cytop View Post
    Your current code would help...

    In the absence of - and assuming you have a reference to the copied sheet and you want to delete all shapes:
    Please Login or Register  to view this content.
    If there's nothing to call the procedures then that would do what you want - however the code will remain in the workbook unless you also save it as a XLSX file.
    Hi Cytop,

    My code is as follows:

    Please Login or Register  to view this content.

    Thanks,

    Tony.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Then simply the following in each block for VDS & VCD (Only one shown below)


    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Quote Originally Posted by cytop View Post
    Then simply the following in each block for VDS & VCD (Only one shown below)


    Please Login or Register  to view this content.
    Hi Cytop,

    Sorry but I do not understand?

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    what do you not understand?

  7. #7
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Quote Originally Posted by cytop View Post
    what do you not understand?
    Hi Cytop,

    I do not understand where I need to place

    Please Login or Register  to view this content.
    Also the statement "Move this to the top of the procedure as is the usual convention..."

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    The convention is that variables are declared at the top of a procedure, so move the declaration for s up to where you declare other variables,

    The code sample is shown in situ for one of your worksheets named VDSxxx, I'd presume you want to do the same for the other worksheet called VCD. Simply copy the code to the appropriate place for that sheet.

  9. #9
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Quote Originally Posted by cytop View Post
    The convention is that variables are declared at the top of a procedure, so move the declaration for s up to where you declare other variables,

    The code sample is shown in situ for one of your worksheets named VDSxxx, I'd presume you want to do the same for the other worksheet called VCD. Simply copy the code to the appropriate place for that sheet.
    You mean as the following:

    Please Login or Register  to view this content.

    If so I am getting an error??

  10. #10
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Delete Buttons made from shapes when copying sheet to new workbook

    Quote Originally Posted by Bflare View Post
    Hi Cytop,

    I do not understand where I need to place

    Please Login or Register  to view this content.
    Also the statement "Move this to the top of the procedure as is the usual convention..."
    Cytop,

    Yaayyyyy thanks I have managed to do it. I only required it not to copy the shapes on the VCS sheet. The code I used was:

    Please Login or Register  to view this content.
    I have highlighted the text in red that I used.

    Thank you again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copying a sheet without copying the command buttons
    By LeapingLizard in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-27-2012, 09:17 AM
  2. [SOLVED] Automatically open a different sheet within the workbook when a selection is made
    By clovelly in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-16-2012, 10:53 PM
  3. [SOLVED] Want to just Delete Command Buttons frm a Copied Sheet excluding ALL other Shapes ?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-27-2012, 03:00 AM
  4. Replies: 0
    Last Post: 10-10-2011, 06:56 PM
  5. Delete shapes from active sheet cell range:Resolved
    By ge0rge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2008, 08:01 PM

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