ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Paste Specific Cell to Selected Cell (https://www.excelbanter.com/excel-worksheet-functions/125922-paste-specific-cell-selected-cell.html)

W.Easton

Paste Specific Cell to Selected Cell
 
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.

CLR

Paste Specific Cell to Selected Cell
 
Sub SetCellValue()
'Sets current cell value to that of column D of the same row
ActiveCell.Value = ActiveSheet.Cells(ActiveCell.Row, 4).Value
End Sub

Vaya con Dios,
Chuck, CABGx3





"W.Easton" 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.


Gord Dibben

Paste Specific Cell to Selected Cell
 
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.



galimi

Paste Specific Cell to Selected Cell
 
I have placed an example of what you are looking for at
http://www.HelpExcel.com/examples

The name of the spreadsheet is copyColumn.xls
--
http://HelpExcel.com




"W.Easton" 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.


W.Easton

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.




W.Easton

Paste Specific Cell to Selected Cell
 
Thank you, I combined your ActiveCell line with what Gord posted below and it
works great.
I really appreciate the fast response.

Thank you,
W. Clay Easton
--
Mistakes have been made, others will be blamed


"CLR" wrote:

Sub SetCellValue()
'Sets current cell value to that of column D of the same row
ActiveCell.Value = ActiveSheet.Cells(ActiveCell.Row, 4).Value
End Sub

Vaya con Dios,
Chuck, CABGx3





"W.Easton" 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.


CLR

Paste Specific Cell to Selected Cell
 
Happy to help, and thanks for the feedback..........

Vaya con Dios,
Chuck, CABGx3



"W.Easton" wrote:

Thank you, I combined your ActiveCell line with what Gord posted below and it
works great.
I really appreciate the fast response.

Thank you,
W. Clay Easton
--
Mistakes have been made, others will be blamed


"CLR" wrote:

Sub SetCellValue()
'Sets current cell value to that of column D of the same row
ActiveCell.Value = ActiveSheet.Cells(ActiveCell.Row, 4).Value
End Sub

Vaya con Dios,
Chuck, CABGx3





"W.Easton" 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.



All times are GMT +1. The time now is 03:15 PM.

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