How to soft a selected range of data in Excel by using VB.Net

  • Thread starter Thread starter Chan Ho Seng
  • Start date Start date
C

Chan Ho Seng

I'm facing a problem, I can't be able to sort a selected
range of data when I use this command in VB.Net.

Worksheet.UsedRange.Sort("A15",
XlSortOrder.xlAscending, "B15", ,
XlSortOrder.xlAscending, "C15", XlSortOrder.xlAscending,
XlYesNoGuess.xlYes, 1, False,
XlSortOrientation.xlSortColumns, XlSortMethod.xlPinYin)

is this command any wrong? please help me, thanks
 
Here is the argument list for the sort command (from xl2000).

expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
OrderCustom, MatchCase, Orientation, SortMethod)

Notice that after the first key and order, there is a type variable which
you seem to have missed.
 
Thanks for you replying for me, What should I put in that missed *Type
Variable
 
Type Optional Variant. Specifies which elements are to be sorted. Can be
one of the following XlSortType constants: xlSortLabels or xlSortValues. Use
this argument only when sorting PivotTable reports.



Since you are not using named arguments you would at least need to use two
commas



Sort(key1,order1,,key2,order2, etc
 

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

Back
Top