How to sort in the worksheet?

  • Thread starter Thread starter YaYa
  • Start date Start date
Y

YaYa

Hello,

I write a asp.net web page with Excel.Application for creating a Excel File.
I want that worksheet be sorted by some column.
I use xlSheet.Range(xx).Sort(xlSheet.Range(xxx)).
But it doesn't sort by my assigning.

How to sort the worksheet?

Thanks
 
You have a syntax error
xlSheet.Range(xx).Sort xlSheet.Range(xxx)

If you include the arugment in parentheses and you are not returning a
value, you cause the argument to be evaluated, so in this case, the argument
becomes the value in the range rather than a reference to the range (which
is what is required).
 
Back
Top