ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy cell on click (https://www.excelbanter.com/excel-discussion-misc-queries/74969-copy-cell-click.html)

Arkenor

Copy cell on click
 
I want to click on a cell and have that cell automatically copy without
"right clicking and going to copy" so I can quickly paste it into a different
part of the same work sheet.

I also want to be able to quickly paste cell also in the same way into a
different part of the worksheet.

(IE List of names on the left side of worksheet, and on right side of
worksheet I want to be able to paste these names just by clicking from one
side to the other.)

Snow Dog

Copy cell on click
 
What a coincidence that we should have the same question two hours apart.
Unfortuntely then, I can't help you. Hopefully someone can help us both.

Arkenor wrote:
I want to click on a cell and have that cell automatically copy without
"right clicking and going to copy" so I can quickly paste it into a different
part of the same work sheet.

I also want to be able to quickly paste cell also in the same way into a
different part of the worksheet.

(IE List of names on the left side of worksheet, and on right side of
worksheet I want to be able to paste these names just by clicking from one
side to the other.)


Gary''s Student

Copy cell on click
 
How about a double-click??

Take this macro and paste it into worksheet code (not a module):


Public tick
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If tick = 0 Then
Selection.Copy Range("Z100")
tick = 1
Else
Range("Z100").Copy Selection
tick = 0
End If
End Sub


This code makes use of a helper cell (Z100). Double-click the source and it
will copy, then double-click the destination and it will paste.

Just remember to put it in worksheet code.
--
Gary's Student


"Snow Dog" wrote:

What a coincidence that we should have the same question two hours apart.
Unfortuntely then, I can't help you. Hopefully someone can help us both.

Arkenor wrote:
I want to click on a cell and have that cell automatically copy without
"right clicking and going to copy" so I can quickly paste it into a different
part of the same work sheet.

I also want to be able to quickly paste cell also in the same way into a
different part of the worksheet.

(IE List of names on the left side of worksheet, and on right side of
worksheet I want to be able to paste these names just by clicking from one
side to the other.)



Snow Dog via OfficeKB.com

Copy cell on click
 
OK, Thanks! I havn't tried it yet but thanks for the info.

Gary''s Student wrote:
How about a double-click??

Take this macro and paste it into worksheet code (not a module):

Public tick
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If tick = 0 Then
Selection.Copy Range("Z100")
tick = 1
Else
Range("Z100").Copy Selection
tick = 0
End If
End Sub

This code makes use of a helper cell (Z100). Double-click the source and it
will copy, then double-click the destination and it will paste.

Just remember to put it in worksheet code.
What a coincidence that we should have the same question two hours apart.
Unfortuntely then, I can't help you. Hopefully someone can help us both.

[quoted text clipped - 9 lines]
worksheet I want to be able to paste these names just by clicking from one
side to the other.)


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200603/1

Arkenor

Kinda figured it out.
 
After some hunting and pecking and my lack of knowledge of VBS this is what I
came up with.

The only thing I don't like is all the ElseIf Statements. Havn't figured
out how to do a range instead of a column. Going to work on that today.

***************
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 Then
Selection.COPY
ElseIf Target.Column = 7 Then
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ElseIf Target.Column = 9 Then
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ElseIf Target.Column = 10 Then
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End If

End Sub
*********************


All times are GMT +1. The time now is 01:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com