I'm bringing data in from a download and it appears in reverse row order to what I need. This seems like a very common situation so I was trying to either find or write a subroutine for the purpose of reversing the row order.
So, the "specification" could be: copy a range in one sheet and paste it in another sheet with the row order reversed.
One can meet this need by creating a sorting macro but the strangeness here seems good to be investigated.
Here is the code with the short loop near the end:
The code is intended to take the last row of the original data and put it in the first row of the destination and iterate from there.Please Login or Register to view this content.
Instead, it takes the last row of the original data and puts it in the 2nd row of the destination - skipping the first row of the destination altogether.
After that, the iteration continues as it should but ends one row too many in the destination as one might expect if the first action is delayed.
The Debug.Print statements in the loop are helpful. I watch the destination sheet in a separate screen to confirm all this happening.
Changing DestRow value to 1 seems to fix it but I don't know why. Seems a good opportunity for learning.
Thank you!!
Bookmarks