Copy to clipboard

andyb63gb

New Member
Joined
Jul 3, 2017
Messages
2
Hello all, sorry if this has already been covered

I simply want a macro in excel that will do the following;

copy the contents of cell A1 to windows clipboard (to paste into another program using Ctrl V)
delete cell A1 moving column up
select cell A! for next time.

Ive tried;

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+z
'
Range("A1").Copy
ActiveCell.FormulaR1C1 = ""
Range("A1").Select
Selection.Delete Shift:=xlUp
End Sub

but when I go tho the program field I want to copy to, its not there.

Any tips please
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the forum!

There are quite a few ways to load the clipboard. I think you're method is failing because when you use Copy, you'll notice a dotted line around the range being copied. Once the dotted line disappears, windows drops the item in the clipboard.

Try:
Code:
Sub LoadClipboard()
Dim dObj As Object


Set dObj = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
dObj.SetText [A1]
dObj.PutInClipboard
Set dObj = Nothing


[A1].Delete Shift:=xlUp


End Sub
 
Upvote 0
alternative way using Microsoft Forms reference

Code:
Sub Macro1()
Dim clipb As MSForms.DataObject
Set clipb = New MSForms.DataObject
clipb.SetText Range("A1").Value
clipb.PutInClipboard
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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