Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default 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.





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default 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.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
Paste under selected cell Btobin0 Excel Discussion (Misc queries) 4 May 30th 06 01:38 AM
Help with this conditional IF statement C-Dawg Excel Discussion (Misc queries) 3 May 15th 06 06:01 PM
linking a cell with a specific letter value to a cell with a formu tommo64 Excel Worksheet Functions 4 April 3rd 06 10:44 AM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej New Users to Excel 4 May 30th 05 07:28 PM


All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"