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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Rakki

New Member
Joined
Jan 16, 2005
Messages
2
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
 

Glaswegian

Well-known Member
Joined
Oct 14, 2003
Messages
1,487
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
 

Forum statistics

Threads
1,148,218
Messages
5,745,444
Members
423,952
Latest member
EduardoM

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
Top