Paste Specific Cell to Selected Cell
This almost worked, but I replaced your
...Value = Excel.Range("D" & n).Value
with
ActiveCell.Value = ActiveSheet.Cells(ActiveCell.Row, 4).Value (posted by CLR
above)
and it worked great, the double click function makes this really handy too.
Thank you,
W. Clay Easton
"Gord Dibben" wrote:
Assign this to a button.
Sub copyit()
n = ActiveCell.Row
With ActiveCell
..Value = Excel.Range("D" & n).Value
End With
End Sub
OR Double-click on a cell...........no button needed.
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
n = Target.Row
With Target
..Value = Excel.Range("D" & n).Value
End With
SendKeys "{ENTER}", True
End Sub
The copyit macro will be pasted into a general module.
The BeforeDoubleClick event code will be pasted into a sheet module.
Gord Dibben MS Excel MVP
On Fri, 12 Jan 2007 09:56:02 -0800, W.Easton <-=spam=- at meleetech [,] com
wrote:
I am trying to make a funtion (because I am lazy, and there are about 3k
worth of lines that I need to go through) that will copy a specific cell to
the selected cell
Basically what I would like it to do is when I select a cell and and hit a
button it would copy the contents from the current row, column 4 to the
selected cell.
|