Transpose from last to first

  • Thread starter Thread starter Angela
  • Start date Start date
A

Angela

I need some help!!!
Im trying to copy and paste from a column to a row but I want to paste the
information from last to first. How do I do that...:
This is an example of what I need:

From:
1
2
3
4
To :
4 3 2 1
Thank you
 
Sub lasttofirst()
'test with column A

Dim rngA As Range
Dim i As Long
Dim nextColum As Integer

Set rngA = ActiveSheet.Range(Cells(1, "A"), _
Cells(Rows.Count, "A").End(xlUp))
'Work backwards from bottom to top
nextColum = 2
With rngA
For i = .Rows.Count To 1 Step -1
Cells(2, nextColum).Value = .Cells(i)
nextColum = nextColum + 1
Next i
End With
End Sub
 
Change the sort order from ascending to descending and then copy and
paste/transpose as usual. If your actual data does not have a column you can
sort with, you can add a helper column of incremented numbers to accomplish
the task.
 
Angela,

Do it in 2 stages.
First select the data copy it and then select your start cell and
Edit |Paste special|transpose
Select the transposed data and then
data|Sort|Options select left to right and do your sort
Mike
 
I need some help!!!
Im trying to copy and paste from a column to a row but I want to paste the
information from last to first. How do I do that...:
This is an example of what I need:

From:
1
2
3
4
To :
4 3 2 1
Thank you

You could do it with a formula, so sorting would not be required.

NAME your column of data "rng".

Then enter this formula in some cell, and fill right as far as required:

=IF(COLUMNS($A:A)>ROWS(rng),"",INDEX(rng,ROWS(rng)+1-COLUMNS($A:A)))

--ron
 
Copy and paste special>transpose then sort left to right on the row.


Gord Dibben MS Excel MVP
 

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

Similar Threads


Back
Top