+ Reply to Thread
Results 1 to 5 of 5

Userform button action - clear,copy paste and print crashes. Please help with code

  1. #1
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Userform button action - clear,copy paste and print crashes. Please help with code

    Hi all,
    can somebody have a look at the code please.
    I will try to explain in easy way:
    This code after i press "print sheet" button on the userform clears the content in the CheckSheet (Sheet2) worksheet, then it takes data from the userform copies it to the next row in the CheckSheet (Sheet2) worksheet, and then prints it out.
    Everything works fine if i'm running userform when i'm on the CheckSheet worksheet. But if i'm trying to run this code (open the userform and click "print sheet" button) from any other worksheet for example "NEW" (Sheet3) it comes with the debug error and after i'm clicking back to the CheckSheet (Sheet2) worksheet, excel crashes.
    I highlighted in red on witch line the code stops if i'm working when the worksheet "NEW" is active.
    I'm trying to solve this for the last six hours, maybe somebody can help me please. Is there anything in the code what makes excel to crash?

    Thanks

    Please Login or Register  to view this content.
    Last edited by intex; 07-05-2014 at 12:17 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Userform button action - clear,copy paste and print crashes. Please help with code

    Hi, intex,

    you should split up the activating of the sheet and after that (as it´s own command) select the range (I´d recommend not to Select nor Activate). Or you try
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Userform button action - clear,copy paste and print crashes. Please help with code

    Hi HaHoBe,
    After i copied your code it highlights the A11 and says:
    Expected : List separator or )
    Please Login or Register  to view this content.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Userform button action - clear,copy paste and print crashes. Please help with code

    Hi, intex,

    my bad, just copierd it over from your post. It should read
    Please Login or Register  to view this content.
    You´ve got the same error in your code on various other instances as well, you might consider to work with objects for the sheets where you would need to set a reference only at one point in code (that also means altering the code at one point only) or work with the codenames of the sheets.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Userform button action - clear,copy paste and print crashes. Please help with code

    O sorry i missed that too, thanks a lot it works like charm. I can't believe it was so simple.
    Thanks 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. VBA Code for a Button (Copy, Paste) not working. Help Please
    By pelle3988 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-12-2013, 04:45 PM
  2. [SOLVED] Copy/paste button code work wrong
    By mirenoba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-05-2013, 05:52 AM
  3. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  4. Copy/paste-button - wrong reference code in sheet 2
    By Krapter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2009, 05:17 AM
  5. Assign menu action to userform button
    By Yappa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2008, 10:58 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