reverse or flip rows

  • Thread starter Thread starter tombates
  • Start date Start date
T

tombates

I have data that looks like this:
123 456 789
avb yu3 111

I need to flip this arrangement so that I get:
avb yu3 111
123 456 789

I might I programatically achieve this result

Mary
 
I have data that looks like this:
123 456 789
avb yu3 111

I need to flip this arrangement so that I get:
avb yu3 111
123 456 789

I might I programatically achieve this result

Mary

That would depend. You can, of course, achieve the result
programmatically. However through excel what you could do is
1. Add a new column and insert serial numbers
2. Sort the data range based on this column -- descending. You should
have the flipped results
 
You can do this with keyboard and mouse. It's easier done than said:

1. Highlight one of the rows by clicking its row number.
2. Pass your mouse over the upper or lower border of the highlighted
row until the cursor changes. It doesn't matter which border.
3. While pressing Shift, drag the border across the other row, just to
the other side.
4. Release mouse button.
5. Release shift key.


If your rows are always the same (here, row 10 and 11), a recorded
macro will give you:

Sub SwapRows()
Rows("11:11").Select
Selection.Cut
Rows("10:10").Select
Selection.Insert Shift:=xlDown
End Sub


If your rows are not always the same, highlight the upper row and run
this macro:

Sub SwapUpperRowWithLower()
Selection.Cut
ActiveCell.Offset(2, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
End Sub


Hope this helps,
- David
 

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

Back
Top