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.

35 Responses to Excel VBA: Empty Clipboard Excel

  1. Pingback: debt consolidation companies

  2. Pingback: how reverse mortgage works

  3. Pingback: debt consolidation companies

  4. Pingback: debt consolidation companies

  5. Pingback: reversemortgage

  6. Pingback: side effects of strattera

  7. Pingback: www.frostwirefree.net

  8. Pingback: Alternative Energy Projects

  9. Pingback: walmart credit card

  10. Pingback: dating factory

  11. Pingback: debt collection rate

  12. Pingback: ?????

  13. Pingback: dating affiliate

  14. Pingback: Wedding photographer calgary

  15. Pingback: collection agency rates

  16. Pingback: permanent magnet generator

  17. Pingback: collection agency

  18. Pingback: workout girls

  19. Pingback: collection agency newsletter

  20. Pingback: Movie car crashes

  21. Pingback: wedding photographer calgary

  22. Pingback: Plantas Medicinales

  23. Pingback: Cheap Winn Golf Club

  24. Pingback: buy facebook likes

  25. Pingback: Escort

  26. Pingback: 7zip

  27. Pingback: Canon EOS 60D Reviews

  28. Pingback: modrod

  29. Pingback: High PR Dofollow Backlinks

  30. Pingback: Erotiek Groothandel

  31. Pingback: business cards

  32. Pingback: Free Car Insurance Quote

  33. Pingback: garden services north london

  34. Pingback: target coupons printable

  35. Pingback: comprar enlaces}

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>