# Excel - Copy/Paste Macro



## Dreambringer (Jan 19, 2005)

Quick question, should be easy but I have been struggling with it.


What I am trying to do is, copy the data from Row 2 and copy it into J1, and continue down the list until there are not more records.

ie.

1 ab ab ab ab ab ab ab 
2 ba ba ba ba ba ba ba ba

Then delete the 2nd row, and continue on down.

1 ab ab ab ab ab ab ab ba ba ba ba ba ba ba ba

and continue down the list until the last record.

I have attached a sample sheet.

Please help!


----------



## bomb #21 (Jul 1, 2005)

Hi ma'am. Err, which data from row 2?


----------



## Dreambringer (Jan 19, 2005)

All the data in every other row, needs to be put into the previous row.
1.
2.
3.
4.
5.
6.
would be...

1.2.
3.4.
5.6.

sorry I really do not know whot to expalin it


----------



## bomb #21 (Jul 1, 2005)

So you want A2 & across to go to J1, A4 & across to go to J3, etc.?

*NB: save your work first.*

With A1:A12 selected,

For Each Cell In Selection
If InStr(Cell, "Master - ") <> 0 Then
Cell.Resize(1, 58).Copy Cell.Offset(-1, 9)
Cell.EntireRow.ClearContents
End If
Next Cell

(perhaps)


----------



## Dreambringer (Jan 19, 2005)

Thanx! But I think I got it.. 

Maybe you can clean it up...


```
Option Explicit

Sub MrClean()
Dim row1 As Variant
Dim row2 As Variant
Dim cell1 As Variant
Dim cell2 As Variant
Dim cell3 As Variant

cell1 = "J1"
cell2 = "A2"
cell3 = "BP2"

row1 = 1
row2 = 2

Do Until Range(cell2).Value = ""
    cell1 = "J" & row1
    cell2 = "A" & row2
    cell3 = "BP" & row2
    
    Range(cell2, cell3).Copy
    Range(cell1).PasteSpecial
    Range(cell2, cell3).Delete
    
    row1 = row1 + 1
    row2 = row2 + 1

Loop

End Sub
```
Let me know what you think.


----------

