Automatic cut and paste

  • Thread starter Thread starter Erix
  • Start date Start date
E

Erix

Hi all,

I have a problem and couldn't figure out how to solve.

I would like to cut only even numbered rows and paste them to the
right side of the previous row on a big worksheet.

Let me show an example;

a b c
1 q w e
2 a s d
3 z x c
4 j k l

An what i would like to do is;

a b c
1 q w e a s d
2
3 z x c j k l
4


Thanks.


Erix.
 
try

Sub lineemup()
For i = 2 To Cells(Rows.Count, "a").End(xlUp).Row Step 2
Range(Cells(i, 1), Cells(i, 3)).Cut Cells(i - 1, 4)
Next
End Sub
 
Here is a way without VBA
1. Enter the formula =mod(row(),2) into the last column and copy it
down. You should get alternate 1 and 0.
2. Select the last column and do Copy, Paste Special, Values. The
formula disappears.
3. Select all columns and sort by the last column, descending order.
4. Select the bottom half of the data, the one next to all the zeros,
and move it to the right side of the top half of data.
 
Back
Top