Excel macro to clear clipboard

Rakki

New Member
Joined
Jan 16, 2005
Messages
2
I need to copy one worksheet paste to another and then clear the clipboard the code I have is
'
Sheets("Sort").Select
Selection.AutoFilter Field:=1, Criteria1:="D1"
Selection.Copy
Sheets("Copy").Select
Cells.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("User").Select
End Sub

Although this code runs it just doesn't clear the clipboard
I have Microsoft Forms 2.0 Object Library in my references
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Thanks for your reply, I have now tried the code

Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Function ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Function
Public Sub ccc()
Call ClearClipboard
End Sub

This code also runs but does not seem to do anything
 
Upvote 0
Hi

Works fine for me. Did you paste it to new module? Trying opening the Clipboard viewer, copy some data, run the Sub ccc() and check the clipboard viewer again.

Regards
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top