Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Order of Copy
I've got this code which works as expected:
Dim myRange As Range Set myRange = Selection Range(myRange.Address).Select Selection.Copy Range("Q8").Select ActiveSheet.Paste What I would like is for the copy beginning at Q8 to be in the reverse order from what's in myRange. How would I accomplish this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Order of Copy
in the reverse order
It's impossible to say since you haven't defined 'reverse order'. For instance if the selection is A1:A4,C3:D3,D3:D5,C11:D11,D14:D16,C20 what would the reverse order be? Btw your posted code is a bit more complex that needed. This is all you need: Selection.Copy Range("Q8") -- Jim "Kirk P." wrote in message ... I've got this code which works as expected: Dim myRange As Range Set myRange = Selection Range(myRange.Address).Select Selection.Copy Range("Q8").Select ActiveSheet.Paste What I would like is for the copy beginning at Q8 to be in the reverse order from what's in myRange. How would I accomplish this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Order of Copy
myRange is always a selection in a single row, such as A1:A4. The reverse
order would be A4:A1. "Jim Rech" wrote: in the reverse order It's impossible to say since you haven't defined 'reverse order'. For instance if the selection is A1:A4,C3:D3,D3:D5,C11:D11,D14:D16,C20 what would the reverse order be? Btw your posted code is a bit more complex that needed. This is all you need: Selection.Copy Range("Q8") -- Jim "Kirk P." wrote in message ... I've got this code which works as expected: Dim myRange As Range Set myRange = Selection Range(myRange.Address).Select Selection.Copy Range("Q8").Select ActiveSheet.Paste What I would like is for the copy beginning at Q8 to be in the reverse order from what's in myRange. How would I accomplish this? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Order of Copy
This seems to do what you want
Sub ReverseCopy() Set myRange = Selection Mycount = myRange.Count k = 17 For j = 1 To Mycount Cells(8, k + Mycount) = myRange(j) k = k - 1 Next j End Sub best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Kirk P." wrote in message ... I've got this code which works as expected: Dim myRange As Range Set myRange = Selection Range(myRange.Address).Select Selection.Copy Range("Q8").Select ActiveSheet.Paste What I would like is for the copy beginning at Q8 to be in the reverse order from what's in myRange. How would I accomplish this? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reverse Order of Copy
myRange is always a selection in a single row, such as A1:A4.
Assuming you meant a single column since that what A1:A4 is: Sub a() Dim CellCount As Long Dim Counter As Long CellCount = Selection.Rows.Count For Counter = 1 To CellCount Selection.Cells(Counter).Copy Range("Q8").Offset(CellCount - Counter) Next End Sub I'd doing a copy/paste because that's what you asked for. That's what you need if you want cell formats and/or formulas transferred as opposed to just values, which is the road Bernard was taking. -- Jim "Kirk P." wrote in message ... myRange is always a selection in a single row, such as A1:A4. The reverse order would be A4:A1. "Jim Rech" wrote: in the reverse order It's impossible to say since you haven't defined 'reverse order'. For instance if the selection is A1:A4,C3:D3,D3:D5,C11:D11,D14:D16,C20 what would the reverse order be? Btw your posted code is a bit more complex that needed. This is all you need: Selection.Copy Range("Q8") -- Jim "Kirk P." wrote in message ... I've got this code which works as expected: Dim myRange As Range Set myRange = Selection Range(myRange.Address).Select Selection.Copy Range("Q8").Select ActiveSheet.Paste What I would like is for the copy beginning at Q8 to be in the reverse order from what's in myRange. How would I accomplish this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I reverse name order from Last, First to First Last in Exc | Excel Discussion (Misc queries) | |||
Reverse Order | Excel Discussion (Misc queries) | |||
Reverse Order | Excel Discussion (Misc queries) | |||
Reverse Order | Excel Discussion (Misc queries) | |||
reverse order | Excel Discussion (Misc queries) |