Excel VBA: Empty Clipboard Excel

Do you ever think or need to clear/empty Clipboard Excel?

I have a big Excel file which abusing the power of copy and paste to format the data and formula. I prefer to update the formula once, then save the result as values, especially for lookup formula. If I am not doing this, each time I am changing something, it will trigger the lookup formula and make the Excel freeze a few minutes.

The down side of the approach, after several hours, Excel will become slower and slower. It’s look like after extensive abuse of copy and paste, the memory will full of data and slower the Excel application.

Fortunately, after applying empty clipboard Excel using VBA macro, the Excel application keep running smoothly until the end of the day.

There are two ways to clear Excel clipboard using VBA.

1. Empty Clipboard Excel Using Excel Application properties

Application.CopyObjectsWithCells = False

2. Empty Clipboard Excel Using Windows Empty Clipboard function

Public Declare Function OpenClipboard Lib "user32" ( _
    ByVal NewOwner As Long) As Boolean
Public Declare Function EmptyClipboard Lib "user32" () As Boolean
Public Declare Function CloseClipboard Lib "user32" () As Boolean

Sub ClearClipboard()
    ' call ClearClipboard() from your other VBA macro to clear/empty Windows Clipboard

    If OpenClipboard(0) Then
        EmptyClipboard
        CloseClipboard
    End If
End Sub

Both approach will empty the Clipboard, but the first approach will only empty copied data from Excel cells, both values and format. It will not empty Clipboard for any data that belong to application. Using Windows Empty Clipboard function, it will empty Clipboard regardless who is the owner of those data.

Just call one of the two functions above inside your macro, before or after you perform any extensive copy and paste macro to clear your Clipboard. For the 2nd approach, you need to put it in one of your VBA modules first.

Do you have another method to clear/empty Excel Clipboard? Please leave your comments below. Thanks.

This entry was posted in Excel VBA Function. Bookmark the permalink.

592 Responses to Excel VBA: Empty Clipboard Excel

  1. Pingback: more info

  2. Pingback: hydraulic fracturing shale gas

  3. Pingback: bad credit mobile phones

  4. Pingback: needs

  5. Pingback: cleaning services sydney

  6. Pingback: alcockandassociates

  7. Pingback: accident lawyer car pearblossom ca

  8. Pingback: http://www.sacochehomme.org/

  9. Pingback: self publishing children s books

  10. Pingback: go

  11. Pingback: hand held credit card machine

  12. Pingback: 1000 poker chips

  13. Pingback: official link

  14. Pingback: check this out

  15. Pingback: bowmel chrysler duncan bc

  16. Pingback: hip dysplasia in older dogs

  17. Pingback: complete life drawing course

  18. Pingback: plumber

  19. Pingback: chasuble

  20. Pingback: web design brisbane

  21. Pingback: Creation Site Internet Annecy

  22. Pingback: Juegos online de futbol gratis

  23. Pingback: vitamins

  24. Pingback: property documents

  25. Pingback: become a chef

  26. Pingback: Electronics

  27. Pingback: signup scrapebox list

  28. Pingback: Drug Recall

  29. Pingback: purchase here

  30. Pingback: beat maker

  31. Pingback: Immobilier Concarneau

  32. Pingback: want to start a business

  33. Pingback: "EcologicalSurfactants

  34. Pingback: freshrankings com program

  35. Pingback: graphic design

  36. Pingback: casque bluetooth

  37. Pingback: life coach austin

  38. Pingback: insurance policy terms

  39. Pingback: promoting and celebrating Virginia creativity

  40. Pingback: remote system backup

  41. Pingback: Zithromax Drug Risks

  42. Pingback: arraignment hearing

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>