PROBLEM DEFINITION: In the following Excel VBA sample code snippet (see Listing 1), which is intended just to Copy-Paste the content of Cell "A1" to cell 'A2", the line:
Application.Calculation = xlCalculationManual
seemingly erases Clipboard Memory, causing a Run-time error. Moreover, any of the following similar statements will produce the same effect:
Application.Calculation = xlManual
Application.Calculation = xlAutomatic
Listing 1.
'demo Sub demonstrating Clipboard Memory flash by the statement
'Application.Calculation = xlCalculationManual
Sub CopyPaste()
'select cell with some test value
Range("A1").Select
'selected value is copied to Clipboard memory
Selection.Copy
'This statement seemingly erases Clipboard memory
'causing Run-Time Error 1004
'if this line is commented-off, the procedure will run normally
Application.Calculation = xlCalculationManual
' test if clipboard is empty ---------------------
On Error Resume Next
ActiveSheet.Paste
If Err Then MsgBox "Error num: " & Err.Number & "|Clipboard is Empty": Err.Clear
'-------------------------------------------------
'target cell to copy value from Clipboard
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub
If you comment-off the aforementioned statement, procedure will run flawless.
QUESTION: Is it true that Application.Calculation = xlCalculationManual statement flashes Clipboard Memory, and if so, why?
Any reference to a Microsoft Excel documentation would be appreciated.