Copy paste with clicking

subtleskeptic

New Member
Joined
Sep 11, 2016
Messages
46
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello, searched around this forum couldn't come up with anything...
I'm trying to set up a macro so that I can click any value in a list, copy the value, and click again in any cell to paste special value the entry... in the same worksheet.

any ideas please?
thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Not sure why you'd need a macro for that. All that functionality already exists with the context menu. Just right click the cell you want to copy, select Copy, then right click the cell where you want to paste it, then select the 2nd option under Paste Options.
 
Upvote 0
Try this "BeforeRightClick" event
Right click value to "Copy" right click elsewhere to "Paste"
Code:
Private [COLOR="Navy"]Sub[/COLOR] Worksheet_BeforeRightClick(ByVal Target [COLOR="Navy"]As[/COLOR] Range, Cancel [COLOR="Navy"]As[/COLOR] Boolean)
Cancel = True
Static Temp [COLOR="Navy"]As[/COLOR] Range
    [COLOR="Navy"]If[/COLOR] Temp [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]Set[/COLOR] Temp = Target
    [COLOR="Navy"]Else[/COLOR]
        Target = Temp
        [COLOR="Navy"]Set[/COLOR] Temp = Nothing
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

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