Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |