Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to copy & paste cell data into another cell

Hello;
I want to copy & paste the cell data when any cell in the worksheet
gets selected. I would like to have the data stored in a list either on the
same worksheet or in another worksheet. I have the selected cells background
color change when selected but having trouble putting the cells contents into
another cell.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro to copy & paste cell data into another cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng as Range, rng1 as Range, col as Long
set rng = Target(1)
cell.Interior.ColorIndex = xlnone
rng.Interior.ColorIndex = 5
col = worksheets("sheet2").Cells(1,256).End(xltoleft).co lumn
set rng1 = worksheets("sheet2").Cells(rows.count,col).End(xlu p)
if not isempty(rng1) then set rng1 = rng1.offset(1,0)
if rng1.row 65000 then
col = col + 1
set rng1 = Worksheets("Sheet2").Cells(1,col).value
end if
rng1.value = rng.Value
End Sub

--
Regards,
Tom Ogilvy

"dannyboy" wrote in message
...
Hello;
I want to copy & paste the cell data when any cell in the

worksheet
gets selected. I would like to have the data stored in a list either on

the
same worksheet or in another worksheet. I have the selected cells

background
color change when selected but having trouble putting the cells contents

into
another cell.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to copy & paste cell data into another cell

Thanks!!!
Works Great.


"Tom Ogilvy" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng as Range, rng1 as Range, col as Long
set rng = Target(1)
cell.Interior.ColorIndex = xlnone
rng.Interior.ColorIndex = 5
col = worksheets("sheet2").Cells(1,256).End(xltoleft).co lumn
set rng1 = worksheets("sheet2").Cells(rows.count,col).End(xlu p)
if not isempty(rng1) then set rng1 = rng1.offset(1,0)
if rng1.row 65000 then
col = col + 1
set rng1 = Worksheets("Sheet2").Cells(1,col).value
end if
rng1.value = rng.Value
End Sub

--
Regards,
Tom Ogilvy

"dannyboy" wrote in message
...
Hello;
I want to copy & paste the cell data when any cell in the

worksheet
gets selected. I would like to have the data stored in a list either on

the
same worksheet or in another worksheet. I have the selected cells

background
color change when selected but having trouble putting the cells contents

into
another 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
Need help with macro to copy, paste, and clear cell values Anthony[_5_] Excel Discussion (Misc queries) 8 December 21st 09 02:11 PM
copy paste cell with value using macro ramzi Excel Discussion (Misc queries) 0 August 15th 08 04:38 AM
Want to use a Macro to copy and paste cell *value* only HeadRusch Excel Discussion (Misc queries) 1 May 11th 07 11:06 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
create a macro to copy/paste cell data joshua.v Excel Programming 1 September 14th 04 04:42 PM


All times are GMT +1. The time now is 03:51 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"