ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Sorting In VB (https://www.excelbanter.com/excel-programming/407305-excel-sorting-vbulletin.html)

Joe S[_2_]

Excel Sorting In VB
 

This statement 'ExcelRangeDistList.Sort (ExcelWSheetDistList.Columns("A")),
xlAscending' works just fine in VB6 but not in VB.NET.

Here's the bigger context:
strTheRange = "A" & CStr(BeginRange) & ":G" & CStr(TotalListRowCnt)
Set ExcelRangeDistList = ExcelWSheetDistList.Range(strTheRange)
ExcelRangeDistList.Sort (ExcelWSheetDistList.Columns("A")), xlAscending

As you can see, I am selecting a range, then sort a column A which works as
expected in VB6 but not VB.NET. I've tried several different syntaxes but
sort does not work in the .NET environment. Using the above sort statement, I
get an runtime error. I could create a VB6 com module for the Excel sort,
but that defeats the purposes of getting completely off VB6. Any ideas to try
something that might work?

--
Shapiro J.

John Bundy

Excel Sorting In VB
 
Try this out.

http://www.developerfusion.co.uk/forums/p/25253/94127/
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Joe S" wrote:


This statement 'ExcelRangeDistList.Sort (ExcelWSheetDistList.Columns("A")),
xlAscending' works just fine in VB6 but not in VB.NET.

Here's the bigger context:
strTheRange = "A" & CStr(BeginRange) & ":G" & CStr(TotalListRowCnt)
Set ExcelRangeDistList = ExcelWSheetDistList.Range(strTheRange)
ExcelRangeDistList.Sort (ExcelWSheetDistList.Columns("A")), xlAscending

As you can see, I am selecting a range, then sort a column A which works as
expected in VB6 but not VB.NET. I've tried several different syntaxes but
sort does not work in the .NET environment. Using the above sort statement, I
get an runtime error. I could create a VB6 com module for the Excel sort,
but that defeats the purposes of getting completely off VB6. Any ideas to try
something that might work?

--
Shapiro J.



All times are GMT +1. The time now is 10:20 AM.

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