ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Help Sorting (https://www.excelbanter.com/excel-programming/398088-need-help-sorting.html)

Eric

Need Help Sorting
 
Hello,
I am needing help from the excel Masters. I am completely lost and have
tried to find my way for the past 3 days. I have given up. Please help me.

If I sort from Column A to column H this macro works great

Dim sheet1 As Worksheet
Dim myrange As Range
Dim lrow As Long
Set sheet1 = ActiveSheet
Set myrange = sheet1.Range("A11")
lrow = sheet1.Cells(sheet1.Rows.count, myrange.Column).End(xlUp).Row

Set myrange = myrange.Resize(lrow - myrange.Row + 1, 6)

myrange.sort key1:=Range("A12"), Order1:=xlAscending, _
Key2:=Range("B12"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlSortNormal

Now I need to reverse this whole thing and place the contract #'s in column
H instead of A and the above macro doesn't work. What do I need to do.

Next, I need to sort all of this info by date or by contract #. So, I need
a macro to ask me what contract number to be first so that my program will
graph it.
ie:
123
354
456

Now I want Contract 456 on top.
456
123
354

But now I want Contract 354 on top.

354
123
456

I am sorry to make this so difficult. Hope some on can help me. My email
is

Eric Dickson


Dave Peterson

Need Help Sorting
 
Check one of your earlier posts.

Eric wrote:

Hello,
I am needing help from the excel Masters. I am completely lost and have
tried to find my way for the past 3 days. I have given up. Please help me.

If I sort from Column A to column H this macro works great

Dim sheet1 As Worksheet
Dim myrange As Range
Dim lrow As Long
Set sheet1 = ActiveSheet
Set myrange = sheet1.Range("A11")
lrow = sheet1.Cells(sheet1.Rows.count, myrange.Column).End(xlUp).Row

Set myrange = myrange.Resize(lrow - myrange.Row + 1, 6)

myrange.sort key1:=Range("A12"), Order1:=xlAscending, _
Key2:=Range("B12"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlSortNormal

Now I need to reverse this whole thing and place the contract #'s in column
H instead of A and the above macro doesn't work. What do I need to do.

Next, I need to sort all of this info by date or by contract #. So, I need
a macro to ask me what contract number to be first so that my program will
graph it.
ie:
123
354
456

Now I want Contract 456 on top.
456
123
354

But now I want Contract 354 on top.

354
123
456

I am sorry to make this so difficult. Hope some on can help me. My email
is

Eric Dickson


--

Dave Peterson


All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com