VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,627 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I would like to sort by the second column, but it seems it skips my first column. Is there a way around that?
'added C code to newer version of report Merge the 2
customerRng = Globals.ThisAddIn.Application.Sheets("Customer Summary").Range("A:B")
rawRng = Globals.ThisAddIn.Application.Sheets("Raw SAP").Range("D:E")
rawRng.Copy(customerRng)
customerRng.RemoveDuplicates(1, Microsoft.Office.Interop.Excel.XlYesNoGuess.xlGuess)
customerRng = Globals.ThisAddIn.Application.Sheets("Customer Summary").Range("B:B")
customerRng.Sort(
Key1:=customerRng.Columns(1), Order1:=Excel.XlSortOrder.xlAscending,
Key2:=customerRng.Columns(1), Order2:=Excel.XlSortOrder.xlAscending,
Orientation:=Excel.XlSortOrientation.xlSortColumns,
Header:=Excel.XlYesNoGuess.xlYes,
SortMethod:=Excel.XlSortMethod.xlPinYin,
DataOption1:=Excel.XlSortDataOption.xlSortNormal,
DataOption2:=Excel.XlSortDataOption.xlSortNormal,
DataOption3:=Excel.XlSortDataOption.xlSortNormal)
customerRng.EntireColumn.AutoFit()