copying every other row

S

stylaster

Hi All
I have data in column A1 to A2564. I want to take every other line
ie(A1, A3, A5, etc) and copy that to match the even columns in column
B. ie (A2 would go into B1, A4 would go into B3, etc.
So it is taking the value in every other line and copying it and
moving it up one cell and over one cell.
Thanks!
Roy

Example
A1 1
A2 2
A3 3
A4 4

Result
Al 1 B1 2
A2 now blank
A3 3 B3 3
A4 blank now
 
G

Guest

Sounds like a lot of work to do each one with the mouse! If I understand
correctly you want to move data from A2 to B1, A4 to B3, and etc.. You do
not want to leave data in A2, A4, A6, etc. I have this code setting A2, A4,
A6 etc to Empty, which effectively deletes the content in those cells.

try this: in a module of VB...

Private Sub moveitems()

Dim n As Integer
n = 1
Do Until n > 2654
Cells(n, 2) = Cells(n + 1, 1) 'move the data
Cells(n + 1, 1) = Empty 'delete the original data
n = n + 2 'increase the counter by two to
get every other line
Loop


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top