PDA

View Full Version : Sleeper: Paste not available due to Application event.



mdmackillop
08-15-2005, 04:41 PM
I'm posting in relation to this question.
http://www.vbaexpress.com/forum/showthread.php?t=4594

The attached sheet contains the following code, which seems to clear the clipboard if you try to cut/copy and paste. The actual Application method doesn't seem to matter. Any explanations?


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$12" Then
Application.Calculate
Else
Application.Calculate
End If
End Sub

Ken Puls
08-15-2005, 04:52 PM
I can confirm that it is an issue in 2003. Created a brand new workbook, dumped in your code above, and threw a bunch of numbers on the sheet.

Doesn't matter where you try to copy to/from, you're right. As soon as you select the new cell, the clipboard is cleared.

I tried disabling events, but no difference there...

'Tis very weird! :think:

Ivan F Moala
08-16-2005, 01:33 AM
That is the natural order of events. The clipboard will always be cleared whenever you have code running. i.e that is the default action. This is done by the application to conserve memory. There is a great deal of memory required when ever excel keeps track of the last user action. Depending on your setting Excel keeps a record of up to 16 UNDOS. You can alter this via code but it is recomende to limit the undo to under 100.

Ken Puls
08-16-2005, 09:22 AM
Hi Ivan!

Thanks for chipping in! That does make sense. :yes I knew about the undo issues, although not exactly why.

Is there any way that you know of to avoid this issue?