View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bartman1980 bartman1980 is offline
external usenet poster
 
Posts: 34
Default select row(s) and shift up one place automatically

I want to swap the selected row with the one who is above. So I can
rearrange my products in the right way.

In this example I swap row 3 with 2.

Sub swaprows()
Rows("3:3").Select
Selection.Cut
Rows("2:2").Select
Selection.Insert Shift:=xlDown
End sub

But it is also possible that row 76 is swapped with row 75 depending
on which row is selected by the user.

And it is also possible that row 20 to 25 is selected and that it must
be 19 to 24.

Does anybody have an idea?