deleyd
asked on
C# Excel refactoring code gives different result
Starting with a string representing a range:
was listed twice, so I decided to refactor that out:
string sortRange = "C10:H24";
This then works:worksheet.Range[sortRange].Sort(worksheet.Range[sortRange].Columns[1], xlSortOder.xlDescending);
I saw worksheet.Range[sortRange]Excel.Range r = worksheet.Range[sortRange];
Excel.Range c = r.Columns[1];
r.Sort(c, xlSortOrder.xlDescending);
My refactored version gives a much different result. Why is that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.