+ Reply to Thread
Results 1 to 8 of 8

Application.CutCopyMode=False

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Application.CutCopyMode=False

    When I use the macro recorder this code (in title) comes up frequently. I have deleting all unnecessary code and have been deleting this thinking that it was a default setting which was unnecessary. Am I correct in this assumption? Is there a list that anyone has compiled of the most common coding that can be eliminated when cleaning up?

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Application.CutCopyMode=False

    Application.CutCopyMode=False is seen in macro recorder-generated code when you do a copy/cut cells and paste . The macro recorder does the copy/cut and paste in separate statements and uses the clipboard as an intermediate buffer. I think Application.CutCopyMode = False clears the clipboard. Without that line you will get the warning 'There is a large amount of information on the Clipboard....' when you close the workbook with a large amount of data on the clipboard.

    With optimised VBA code you can usually do the copy/cut and paste operations in one statement, so the clipboard isn't used and Application.CutCopyMode = False isn't needed and you won't get the warning.

    For optimising macro recorder-generated code you can merge adjacent Select and Selection statements and refer directly to sheets and ranges.

    Macro recorder code:
    Please Login or Register  to view this content.
    Optimised version:
    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Application.CutCopyMode=False

    Brilliant Chippy. Great explanation.

  4. #4
    Registered User
    Join Date
    04-30-2015
    Location
    Saratoga Springs
    MS-Off Ver
    2007 and 2010
    Posts
    1

    Re: Application.CutCopyMode=False

    Chippy gave an alternative to copy ranges. Though, some objects have no destination in COPY method. Example: ChartObject Object. Copy method does one thing only - it copies to a Clipboard. Therefore, if you do copy chart (as a template, for example) from one sheet to another and do it frequently in one session, you still have to clear Clipboard with Application.CutCopyMode = False after ActiveSheet.Paste method.

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    581

    Re: Application.CutCopyMode=False

    well
    I gus using this method would be ok
    Range("A1:C5").Cut Destination:=Sheet2.Range("h1")

  6. #6
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    581

    Re: Application.CutCopyMode=False

    well
    I gus using this method would be ok
    Range("A1:C5").Cut Destination:=Sheet2.Range("h1")

  7. #7
    Registered User
    Join Date
    07-12-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    1

    Re: Application.CutCopyMode=False

    I've been using Application.GoTo to attempt to speed up the process of moving data around in a workbook, but it sounds like the optimized version below is even better. What are the pro's and con's of using the optimized version below versus using the following?

    Please Login or Register  to view this content.
    Also, how do I reference a worksheet using the optimized code? I was able to successfully add the worksheet to the optimized code, but I'm struggling to add the workbook as well. IE:

    Please Login or Register  to view this content.
    Quote Originally Posted by Chippy View Post
    Application.CutCopyMode=False is seen in macro recorder-generated code when you do a copy/cut cells and paste . The macro recorder does the copy/cut and paste in separate statements and uses the clipboard as an intermediate buffer. I think Application.CutCopyMode = False clears the clipboard. Without that line you will get the warning 'There is a large amount of information on the Clipboard....' when you close the workbook with a large amount of data on the clipboard.

    With optimised VBA code you can usually do the copy/cut and paste operations in one statement, so the clipboard isn't used and Application.CutCopyMode = False isn't needed and you won't get the warning.

    For optimising macro recorder-generated code you can merge adjacent Select and Selection statements and refer directly to sheets and ranges.

    Macro recorder code:
    Please Login or Register  to view this content.
    Optimised version:
    Please Login or Register  to view this content.
    Last edited by WillDM73; 07-12-2017 at 04:20 PM.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    4,754

    Re: Application.CutCopyMode=False

    @WillDM73
    This is from a recent post where data is copied between workbooks that are both open.
    I am sure you can go through it and get an idea of what you asked for.

    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)

Tags for this Thread

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