Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to do a copy and paste. However, I need the paste to paste
in a different row so they don't overlay. Ihave been trying to do for loops so the the loop would cause the row number to change (i.e. A3 A4 A5). But no success. Please help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Post what you have so far and I'm sure someone can assist.
" wrote: I'm trying to do a copy and paste. However, I need the paste to paste in a different row so they don't overlay. Ihave been trying to do for loops so the the loop would cause the row number to change (i.e. A3 A4 A5). But no success. Please help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 29, 11:38 am, wrote:
I'm trying to do a copy and paste. However, I need the paste to paste in a different row so they don't overlay. Ihave been trying to do for loops so the the loop would cause the row number to change (i.e. A3 A4 A5). But no success. Please help. Do you have some sample code or a more detailed description? Not knowing exactly what you are doing, maybe the following sample code will help. It takes whatever is in A1, copies the content, and then pastes it in the subsequent rows according to the number in the For Loop. Sub copyPaste() Dim a As Integer For a = 1 To 10 Range("a1").Copy Destination:=Range("a" & a + 1) Next End Sub Matt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Carlos,
It would have been better to have posted what you have tried. However, a couple of ways to loop throuhj cells. Sub atomicparticles() Dim myRange As Range Set myRange = Range("A3:A20") For Each c In myRange c.Select 'do something Next End Sub Sub stantial() For x = 1 To 20 Cells(x, 1).Select 'A1 'DO SOMETHING Next End Sub Mike " wrote: I'm trying to do a copy and paste. However, I need the paste to paste in a different row so they don't overlay. Ihave been trying to do for loops so the the loop would cause the row number to change (i.e. A3 A4 A5). But no success. Please help. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub copyPaste()
Const columnA = "A" Dim actWS As Worksheet, i As Long Dim lastrowInColumnA As Long Set actWS = ActiveSheet lastrowInColumnA = actWS.Cells(Rows.Count, columnA).End(xlUp).Row For i = 3 To lastrowInColumnA 'Dosomthing Next i End Sub " wrote: I'm trying to do a copy and paste. However, I need the paste to paste in a different row so they don't overlay. Ihave been trying to do for loops so the the loop would cause the row number to change (i.e. A3 A4 A5). But no success. Please help. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this is the base of my script so far
Sub PasteSpecial() Dim DeleteRows As Range Range("A1:A3").Copy Range("C4").Select ' This is the problem Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Set DeleteRows = Range("A1:A8") ' this deletes the row that I just copied. i.e. cut DeleteRows.Delete Shift:=xlShiftUp End Sub This works great but it will overlap, paste over paste, becuase I have the second range set to C4. I want some how for the C4 to change after every copy so it would be like this... Range("A1:A3").Copy Range("C4").Select ' This is the problem Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Range("A1:A3").Copy Range("C5").Select ' This is the problem Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Range("A1:A3").Copy Range("C6").Select ' This is the problem Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying and Pasting in a Loop | Excel Programming | |||
Loop vertically, copying and pasting inputs for each cell in Col A | Excel Programming | |||
Loop for copying data, then pasting in a continuous row | Excel Programming | |||
Setting up some sort of cutting and pasting loop | Excel Worksheet Functions | |||
copying and pasting loop | Excel Programming |