View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AndyR[_6_] AndyR[_6_] is offline
external usenet poster
 
Posts: 1
Default VB code for Moving Rows up and down


Maybe a bit hasty psoting the message above, after sitting down and
trying it out this simple code seems to work, can anyone see any
tidying up or glaring ommissions that I have made?

Cheers

Andy

Sub MoveDown()

Selection.EntireRow.Select
Selection.Cut
ActiveCell.Offset(2, 0).Range("A1").Select
Selection.EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(-1, 0).Range("A1").Select

End Sub

Sub MoveUp()

Selection.EntireRow.Select
Selection.Cut
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.EntireRow.Select
Selection.Insert Shift:=xlDown

End Sub


--
AndyR
------------------------------------------------------------------------
AndyR's Profile: http://www.excelforum.com/member.php...o&userid=15203
View this thread: http://www.excelforum.com/showthread...hreadid=394456