+ Reply to Thread
Results 1 to 6 of 6

copy and paste sheets

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    copy and paste sheets

    is there a way to copy and paste sheets into another workbook without copying the macros that are in those sheets. I have macro that basically selects 10 sheets from one workbook and copies and pastes those sheets in another new workbook.

    Until now it was no problem because there were no macros on those sheets, but now I had to include a macro for one of the sheets, but I don't want that copied when I run my "copy" macro. I just want the sheet. Any ideas?

  2. #2
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    Re: copy and paste sheets

    If not, then how about deleting the macro from the sheet once copied over? what would be a macro for deleting another macro from the sheet? deleting a private sub from the sheet that it's assigned to?
    Last edited by Mile029; 12-15-2010 at 05:42 PM.

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: copy and paste sheets

    In your code when you paste try:
    Please Login or Register  to view this content.
    I don't know if that would apply what your code is doing but just pasting the values should do it I think.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    Re: copy and paste sheets

    Quote Originally Posted by Mordred View Post
    In your code when you paste try:
    Please Login or Register  to view this content.
    I don't know if that would apply what your code is doing but just pasting the values should do it I think.
    Yes, that line is already in my code. So when the sheets are pasted into a new workbook there are no formulas, just values. That's not really my problem, the problem is there can code attached to the sheet. Ever open VB and double click on one of the sheets in your workbook, it's probably blank for you, well you can assign code to that sheet so whenever a user clicks that sheet from another sheet the code is executed. I don't want that code copied over into a new workbook.

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: copy and paste sheets

    Sorry I can't help on that one. I just made a mock book with a straight copy from a workbook where there is code specifically in a worksheet and didn't have the code go with it. All of the values went from the excel sheet but no code.

  6. #6
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    Re: copy and paste sheets

    Quote Originally Posted by Mordred View Post
    Sorry I can't help on that one. I just made a mock book with a straight copy from a workbook where there is code specifically in a worksheet and didn't have the code go with it. All of the values went from the excel sheet but no code.
    How did you do it? did you right click the worksheet and click "move or copy" and then select "(new book)" and then clicked "create a copy" box and then clicked "OK"?

    First, right click the sheet and click "View Code", is there code there?
    Then do the above
    Then right click the new sheet in the new workbook and click "View Code". Is the code there from the original?

    I just did it without running my macro and yes it is still there.

+ 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