#1   Report Post  
Posted to microsoft.public.excel.misc
CMD
 
Posts: n/a
Default macro for pasting

Hi. I want to paste a list from 1 worksheet to another. The catch is the
list I am copying from is consecutive (row 1, row 2, row 3, etc..). I want
to paste it such that it skips 2 rows. So the list will be pasted in row 1,
row 4, row 7, etc. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
ngenear11
 
Posts: n/a
Default macro for pasting


you can begin by recording a macro that copies the text and pastes.
then edit the macro and change where it selects to paste.
ie:

'put your code to copy
Worksheet("sheet1").Activate 'activates the sheet you want to copy to
Range("A1").Select 'gives you a starting position to
paste
counter=0
ActiveCell.Offset(counter,0)
Selection.Paste
counter=counter+3


you can then implement this same approach to copy the code and just use
counter=counter +1 to copy all of the rows.-you can control this with a
loop and have it stop when the cell is empty-
ie:
do
'copy whatever you want
loop until IsEmpty(ActiveCell.Offset(counter2,0))


--
ngenear11
------------------------------------------------------------------------
ngenear11's Profile: http://www.excelforum.com/member.php...o&userid=34844
View this thread: http://www.excelforum.com/showthread...hreadid=545979

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default macro for pasting

One way:

Option Explicit
Sub testme()
Dim fWks As Worksheet
Dim tWks As Worksheet
Dim iRow As Long

Set fWks = Worksheets("sheet1")
Set tWks = Worksheets("sheet2")

With fWks
For iRow = 1 To .Cells(.Rows.Count, "A").End(xlUp).Row
.Rows(iRow).Copy _
Destination:=tWks.Cells(iRow * 2 - 1, "A")
Next iRow
End With

End Sub


But if you're doing this to make it look double spaced (for viewing or
printing), I think I'd just change the rowheights.

It'll make sorting/filtering/charting/etc much easier if you don't insert those
extra rows.

CMD wrote:

Hi. I want to paste a list from 1 worksheet to another. The catch is the
list I am copying from is consecutive (row 1, row 2, row 3, etc..). I want
to paste it such that it skips 2 rows. So the list will be pasted in row 1,
row 4, row 7, etc. Thanks.


--

Dave Peterson
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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 11:30 PM.

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

About Us

"It's about Microsoft Excel"