How to sort in the worksheet?

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
 
T

Tom Ogilvy

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top