ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting Problem (https://www.excelbanter.com/excel-programming/393924-sorting-problem.html)

NewToVB

Sorting Problem
 
Im using Visual Studio and I'm trying to sort by column D in ascending order
and sort all of the columns with it ("A3:CQ" & lastRow)

LCV.Range("D3:D" & lastRow).Sort(LCV.Range("A3:CW" & lastRow),
XlSortOrder.xlAscending, (LCV.Range("O3:O" & lastRow)

Its adding information at the end of my data in a new column, any ideas what
I'm doing wrong? Thanks!


NewToVB

Sorting Problem
 
Ok I figured out that I had to add in the extra arguments, but its still not
doing it right, its adding info. at then end of my data. Any ideas?

LCV.Range("A3:CW" & lastRow).Sort(LCV.Range("D3:D" & lastRow),
XlSortOrder.xlAscending, Header:=XlYesNoGuess.xlNo, MatchCase:=False,
Orientation:=XlSortOrientation.xlSortColumns,
SortMethod:=XlSortMethod.xlPinYin, DataOption1:=XlSortDataOption.xlSortNormal)

"NewToVB" wrote:

Im using Visual Studio and I'm trying to sort by column D in ascending order
and sort all of the columns with it ("A3:CQ" & lastRow)

LCV.Range("D3:D" & lastRow).Sort(LCV.Range("A3:CW" & lastRow),
XlSortOrder.xlAscending, (LCV.Range("O3:O" & lastRow)

Its adding information at the end of my data in a new column, any ideas what
I'm doing wrong? Thanks!



All times are GMT +1. The time now is 06:33 AM.

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