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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,326
Members
452,635
Latest member
laura12345

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