copy cell on double click to another worksheet

neto1a

New Member
Joined
Aug 11, 2014
Messages
4
Hello, I know there are other threads on this subject, but because of my poor knowledge in vba I couldn't adapt the answers to my problem.

What I need:
WhenI give two clicks in a cell (c3:d10, worksheet"PM") , copy the cell's value and paste on D1, worksheet"PLANEJAMENTO".

Thank you.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Right click the PM sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("C3:D10")) Is Nothing Then
    Cancel = True
    Target.Copy Destination:=Sheets("PLANEJAMENTO").Range("D1")
End If
End Sub
 
Upvote 0
It worked!
One more thing. Do you know how todo after I give the two clicks in the cell, shows PLANEJAMENTO sheet.
How I do to paste on destination formatting, because it copies the formatting of the table C3:D10.

Thanks a lot.
 
Upvote 0
Try

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("C3:D10")) Is Nothing Then
    Cancel = True
    Target.Copy
    Sheets("PLANEJAMENTO").Range("D1").PasteSpecial Paste:=xlPasteValues
End If
End Sub
 
Upvote 0
It worked, after double click was paste only the value (and stay destination formatting).
But the PLAN come back to PM sheet, and the cell stay selected, like when you press ctrl C
 
Upvote 0
Try

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("C3:D10")) Is Nothing Then
    Cancel = True
    Target.Copy
    Sheets("PLANEJAMENTO").Range("D1").PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    Sheets("PLANEJAMENTO").Select
End If
End Sub
 
Upvote 0
This was a neat solution that worked well for me too.

It's an old thread, but can I ask how to add an a way to OFFSET the cell that is copied?

ie. I want to double click a name and copy their ID to the other sheet.
In my case, double click a cell in E:E then copy the cell from C:C and paste into another sheet.

Answer here, or should I start a new post?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,810
Members
449,339
Latest member
Cap N

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