Moving Cells

  • Thread starter Thread starter DaveB
  • Start date Start date
D

DaveB

I have 3,000 rows in my worksheet. I just want to move
every other row up one line:

Smith, John (cell A1)
Biology Dept (cell A2)

I want to move cell A2 to B1...and

Jones, Sam (cell A3)
Anesth Dept (cell A4)

I want to move cell A4 to B3..and so on throughout my
worksheet. Thanks for the code in advance.

DaveB
(e-mail address removed)
 
Hi Dave
try the following macro:
sub move_cell()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = 2 to LastRow step 2
cells(RowsNdx-1,2).value=cells(RowNdx,1).value
cells(RowNdx,1).clearcontents
Next RowNdx
Application.ScreenUpdating = True
End Sub
 
You can do this with some formulas and helper columns:

in B1: =IF(ISEVEN(ROW(A2)),A2,"")
C1: =IF($B2="",A1,"")
copy C1 to D1.

Then copy B1:D1 down 3000 rows. Then copy n' paste special, and sort out the
spaces.
 
Back
Top