An earlier thread (which remains unsolved), where a User wanted to reverse a range of columns (A:G), on a new worksheet, got me thinking about how you could go about this. Excel's Transpose doesn't appear to have the capabilities to reverse the order.
I found this to reverse the order of rows from a range.
Code:Sub ReverseRows(Optional rng As range = Nothing, Optional firstRowNum As Long = 1, Optional lastRowNum As Long = -1)
Dim i, firstRowIndex, lastRowIndex As Integer
' Set default values for dynamic parameters
If rng Is Nothing Then Set rng = ActiveSheet.UsedRange
If lastRowNum = -1 Then lastRowNum = rng.Rows.Count
If firstRowNum <> 1 Then
' On each loop, cut the last row and insert it before row 1, 2, 3, and so on
lastRowIndex = lastRowNum
For i = firstRowNum To lastRowNum - 1 Step 1
firstRowIndex = i
rng.Rows(lastRowIndex).EntireRow.Cut
rng.Rows(firstRowIndex).EntireRow.Insert
Next
Else
' Same as above, except handle different Insert behavior.
' When inserting to row 1, the insertion goes above/outside rng,
' thus the confusingly different indices.
firstRowIndex = firstRowNum
For i = firstRowNum To lastRowNum - 1 Step 1
lastRowIndex = lastRowNum - i + 1
rng.Rows(lastRowIndex).EntireRow.Cut
rng.Rows(firstRowIndex).EntireRow.Insert
Next
End If
End Sub
The person who wrote this code obviously hasn't dimmed the variables correctly, and aside from that, what needs to be changed? Alternatively is there another method to skin the cat?