In this Article
VBA Application.CutCopyMode = False
If you’ve recorded macros while copying and pasting, you’ve probably seen the following line of code:
Application.CutCopyMode = False
This line of code “clears” the clipboard*. If you’ve copied an Excel cell, running this line of code will remove the animation around the copied cell:
CutCopyMode is an application-level property that indicates whether a Microsoft Office program (ex. Excel) is in Cut or Copy Mode. While in copy (or cut) mode, Excel has something stored in it’s clipboard which can be pasted.
I’m not aware of a time when you would ever need to set Application.CutCopyMode to True.
Avoiding CutCopyMode = False
You can usually avoid needing to set Application CutCopyMode = False by using VBA Copy+Paste best practices. As an example, the following line of code copies and pastes a cell in a single line, removing the need to set CutCopyMode to False:
Sub CopyPaste_OneLine() Range("a1").Copy Range("b1") End Sub
Get Application.CutCopyMode Status
Occasionally, you might want to get the status of Application.CutCopyMode. Potentially to prevent errors while trying to Paste when nothing is in the clipboard. To get the status use the following code:
Sub Get_Application_CutCopyMode_Status() Select Case Application.CutCopyMode Case Is = xlCopy MsgBox "Copy Mode" Case Is = xlCut MsgBox "Cut Mode" Case Is = False MsgBox "Not in Cut or Copy mode" End Select End Sub
*Application.CutCopyMode will only clear the Microsoft Office app (ex. Excel) clipboard. It will not clear Window’s clipboard. Click the link to learn more about how to clear Window’s clipboard using VBA.
VBA Coding Made EasyStop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!