Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I reverse name order from Last, First to First Last in Exc Annie Lord Excel Discussion (Misc queries) 4 April 22nd 23 02:10 AM
Reverse Order PL Excel Discussion (Misc queries) 3 July 1st 09 05:01 AM
Reverse Order PL Excel Discussion (Misc queries) 1 June 17th 09 02:47 AM
Reverse Order PL Excel Discussion (Misc queries) 2 June 15th 09 09:17 AM
reverse order Lamb Chop Excel Discussion (Misc queries) 2 June 20th 06 03:37 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"