#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy and Paste

I am trying create a macro at the push of a button to copy data from a
certain cell or range of cells and then paste into another cell, however if
that cell I am pasting into has data in it I want it to go down 3 cells and
paste it, and so on and so on. I would imagine using the loop function would
work for me but I can't seem to figure it out.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copy and Paste

Dim RngToCopy as range
Dim DestCell as range

with worksheets("Sheet999")
set rngtocopy = .range("a1") 'whatever you want
end with

with worksheets("sheet888")
set destcell = .range("x99") 'some starting cell
end with

do
if isempty(destcell.value) then
exit do
else
set destcell = destcell.offset(3,0)
end if
loop

rngtocopy.copy _
destination:=destcell


Jase wrote:

I am trying create a macro at the push of a button to copy data from a
certain cell or range of cells and then paste into another cell, however if
that cell I am pasting into has data in it I want it to go down 3 cells and
paste it, and so on and so on. I would imagine using the loop function would
work for me but I can't seem to figure it out.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy and Paste

Dave, thank you for the help but the data is just pasting over the DestCell
its not looking for the next available free cell.

"Dave Peterson" wrote:

Dim RngToCopy as range
Dim DestCell as range

with worksheets("Sheet999")
set rngtocopy = .range("a1") 'whatever you want
end with

with worksheets("sheet888")
set destcell = .range("x99") 'some starting cell
end with

do
if isempty(destcell.value) then
exit do
else
set destcell = destcell.offset(3,0)
end if
loop

rngtocopy.copy _
destination:=destcell


Jase wrote:

I am trying create a macro at the push of a button to copy data from a
certain cell or range of cells and then paste into another cell, however if
that cell I am pasting into has data in it I want it to go down 3 cells and
paste it, and so on and so on. I would imagine using the loop function would
work for me but I can't seem to figure it out.


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default Copy and Paste

Never mind I got it to work. Thanks Dave.


"Jase" wrote:

I am trying create a macro at the push of a button to copy data from a
certain cell or range of cells and then paste into another cell, however if
that cell I am pasting into has data in it I want it to go down 3 cells and
paste it, and so on and so on. I would imagine using the loop function would
work for me but I can't seem to figure it out.

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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM


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