PDA

View Full Version : Solved: Sort Rows Horizontally



ndendrinos
08-07-2006, 03:10 PM
In this example the data gets transferred from sheet"Lotto 649" to Sheet"Draw" then I need to sort the the row horizontally and I do this with a macro I've recorded (see cmd button in sheet "Draw"
Because of the range I can only sort row A3.

I've tried to incorporate the sorting code to the transferring code with a "with selection etc" ... and that does not work.

Wish I could paste the two codes here but I still have to figure out how to do this in this forum

Thank you

mdmackillop
08-07-2006, 03:35 PM
To simplify things, select each of your circles and set the properties to "Don't move or size with cells" This avoids the need to paste special
The following copies and orders your results


Sub Addto6_49()
Sheets("Lotto 649").Range("B1:G1").Copy _
Sheets("Draw").Cells(Rows.Count, 1).End(xlUp).Offset(1)
With Sheets("Draw").Cells(Rows.Count, 1).End(xlUp)
.Range("A1:F1").Sort _
Key1:=.Range("A1"), Order1:=xlAscending, Orientation:=xlLeftToRight
End With
End Sub



To post code here, just copy and paste it from your modules, then select it and click the VBA button

ndendrinos
08-07-2006, 03:47 PM
Malcom thank you ... Works great!
Regards,
Nick

noobie
11-19-2006, 11:07 PM
I was wondering what if there are duplicate numbers? I tried it with duplicate numbers and the macro only included the one of the two numbers.

ndendrinos
11-20-2006, 06:55 PM
Hello Noobie,
not sure I understand why you would have a problem ... it works for me.
Here is a sample ... If I misunderstodd you please elaborate
Regards
Nick

noobie
11-20-2006, 08:48 PM
Thanks for your response. I've found what I needed in another thread.
I'm also a newbie in this, so currently i have to depend on the forum for help. Good luck! :)

mdmackillop
11-21-2006, 01:43 AM
Hi Noobie,
Can you share yiour problem/solution for the benefit of others who arrive at this thread?
Regards
MD

noobie
11-21-2006, 06:10 PM
Hi,
I tried using a macro from a thread which i can't remember. But failed. So I had to post another thread. Pls see this thread for further understanding.

http://www.vbaexpress.com/forum/showthread.php?t=10281

Thanks once again!