Sunday 15 June 2014

how do I know if my sort worked in excel vba? -


itemprop = "text">

I enter the following macro when sorting data:

  sub-sort_sheet_test () ActiveWindow.ScrollRow = select 1 ActiveWindow.ScrollColumn = 1 range ( "A1: AB40905") ActiveWorkbook.Worksheets to Sort.SortFields.Add ( "flurry_an_output.csv") Sort.SortFields.Clear ActiveWorkbook.Worksheets ( "flurry_an_output.csv") key .. . = _ Range ( "AB2: AB40905"), SortOn: = xlSortOnValues, Order = XlAscending, _ DataOption = XlSortNormal with ActiveWorkbook.Worksheets ( "flurry_an_output.csv") Sort .SetRange Range ( "A1: AB40905") . .Header = xlYes .MatchCase = false .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End  with the End Sub 

I have my own function to normal use of the other sheet. etc .. wrote:

  function long line as sort_sheet_last_column (string as Shit_nam) dim rows 1 1 = Get_Rows_Generic (Shit_nam, 1) get number 'f sheet dim columns1 As rows integer columns1 = range (find_last_column (SHEET_NAME)). Column 'sheet dim sort_range range as the dim key_range range worksheet (SHEET_NAME) set with sort_range as in the number of columns received = .Range (.Cells (1, 1), .mail (line1, column1)) set up: set part made full use of sheet key_range = Krenjh (Ksel (1, column 1), Kmel (row 1, column 1)) = key_range, SortOn :: = xlSortOnValues ​​with the end, in order: = xlAscending, DataOption: = xlSortNormal .SetRange sort_range .Header = xlYes .MatchCase = false .Orientation = xlTopToBottom worksheet (SHEET_NAME) .Sort .SortFields.Clear with .SortFields.Add key. SortMethod = xlPinYin. Finish the end with the end function  

It starts reorganizing the rows based on the right key, but how do I know that my version is 1) working on all (it's difficult Is aware that more than 40,000 rows have been properly ordered, a D2) How do I know that all other data are in their proper order?

I always use sheets. Range. Not Simplified Sheet Summary

  lLastRow = Last used line (shMain) shMain.Range ("A1: W" & LLastRow) .Sort Key1: =. Range ("B2"), _Order 1: = XLAScaching, _Header: = xlYes, _CustomCustom: = 1, _MCCC: = Incorrect, _Ormentation: = XLopTotobotm, _Dataionation1: = XLSOR Normal  

There was no problem sorting this category and you can add Key2, Order2 and DataOption2 to sort by several columns


No comments:

Post a Comment