+ Reply to Thread
Results 1 to 9 of 9

Troubles copying sheet to new workbook.

  1. #1
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Troubles copying sheet to new workbook.

    Hy all,

    I made a script that copy's a sheet, strip is down to value's only and save it. But because of een script running from this sheet whit a userform.show i run in a error.

    Is there a better way to copy a sheet values only to a new workbook?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Troubles copying sheet to new workbook.

    The code looks OK to me. I don't understand what problem you are trying to solve.

    But because of een script running from this sheet whit a userform.show i run in a error.
    No idea what this means. Looks like you wrote this on a phone. Maybe try again with a little more information.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Troubles copying sheet to new workbook.

    This is the scribt what triggers an error.

    Please Login or Register  to view this content.
    The new file hase a problem with the
    Please Login or Register  to view this content.
    because the new sheet does not have this userform.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Troubles copying sheet to new workbook.

    It looks like you are creating a new file to add the sheet copy. I assume that you do not want any macros in the new file. It also looks like you are ignoring the original Sheet1 in the new file. I am going to use that as the target for your copy:

    Please Login or Register  to view this content.
    This will copy the values to the first sheet without copying the VBA code for that sheet.

  5. #5
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Troubles copying sheet to new workbook.

    I run it step by step.
    I goes wrong when
    Please Login or Register  to view this content.
    .

    Than there is a
    Please Login or Register  to view this content.
    error.

    Is it possible to open a new sheet without macro's. .xlsx?

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,533

    Re: Troubles copying sheet to new workbook.

    Should that be?
    Please Login or Register  to view this content.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Troubles copying sheet to new workbook.

    Let's go back to your original code.

    I didn't notice that you were saving as a .xlsx file. That should not have any macros in it. When you re-open it, the error you are describing should not be possible.

    What is the same of the workbook containing the macro you are running, with sheet Invulblad?

  8. #8
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Troubles copying sheet to new workbook.

    This code works like a charm on its own.
    Please Login or Register  to view this content.
    But when i put this code in "sheet1(invulblad)" there is an error at: "Wachtwoord.Show"

    Please Login or Register  to view this content.
    The problem i think is that the new file has the code but not the userform.
    So or i make a new .xlsx file instead of a .xslm. Or i delete the code in the sheet after i copy it.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Troubles copying sheet to new workbook.

    Yes, you should save as a .xlsx file, but it looks like you are saving it as an .xlsx file.

    You may need to do this to force the file type:

    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 03-06-2020, 03:47 AM
  2. [SOLVED] Moving while copying a sheet from various workbook to Master workbook
    By Ravana in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-09-2017, 11:19 AM
  3. Replies: 5
    Last Post: 04-22-2015, 03:48 AM
  4. [SOLVED] Copying data from one workbook sheet to another workbook sheet without overwrriting
    By Amol1988 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-09-2014, 01:58 AM
  5. [SOLVED] Copying specific excel sheet from one workbook to another workbook.
    By shopaholic in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 06-17-2014, 01:55 PM
  6. Format and Copying troubles
    By WadeLair in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2012, 10:20 AM
  7. [SOLVED] Copying data from workbook/sheets to another workbook/sheet
    By yukon_phil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2006, 02:35 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