vba - simple loop used to be fast, now it's slow -
I have a simple piece that was burnt through the data of 45,000 rows in the eyes of the eye and now it takes a Very long (~ 15 minutes). I have read through some similar problems, but I want to post the code because it is very basic, this code is the individual weight of each item (one line per line) of an order, and then a cell for each item with the total amount Allocates to. It goes from top to bottom to get the total and then goes from bottom to bottom to fill the empty space. What am I missing?
Sub-fill Bhartakya () 'File Completely according to the process order' 'This macro tells the weight of children of all processes' and then in that column E total' Long Dim Nrow As long as the dim nLastRow long dim wtTot dim Nstop, 'every line of the process' order' last line 'nLastRow = ActiveSheet.UsedRange.Rows.Count' process order 'by ActiveWorkbook.Worksheets' type Scheduling (. "Zpr2013b") Sort.SortFields.Clear ActiveWorkbook.Worksheets (. "Zpr2013b") Sort.SortFields.Add_Bow : = Range (cells (1, 'D'), cell (nLastRow, 'D')), _ SortOn: = xlSortOnValues, order: = xlAscending, DataOption:. = XlSortNormal ActiveWorkbook.Worksheets ("zpr2013b") sorted (cells (1, 'A'), cell (nLastRow, "q")) with the set range. .Header = xlYes .MatchCase = false .Orientation = xlTopToBottom .SortMethod = WtTot = cells (2, "b") with xlPinYin .Apply end. Value for 'last coil' in the line of '' Going from top to bottom and putting the total weight of each process '' nLastRow for nRow = 2 if cell (nRow, "D") value = cell (nRow + 1 , "D"). Value then wtTot = wtTot + Cells (nRow + 1, "B") value and if the next NRO 'go up from the bottom and fill all the spaces of other calls', 'well', 'n' value = "cell" (x + 1, "E") value = 2 for phase X-1 if cells (X, "E"). Value = "" then cell (x, "e"). I would recommend using this code instead. X and sub
It should be very fast for you to run and the task will be completed:
subfillInTotalWeight () set the worksheet dim form ws = "ActiveWorkbook.Sheets" ("zpr2013b") ws.UsedRange.Sort Intersect (ws.UsedRange, ws.Columns ('D')), xlAscending, Header :. = XlYes with range ("E2", ws.Cells (rows.Count, 'D') and (xlUp) .offset (, 1)). Formula = "= SUMIF (D: D, D" and. Row and ", B: B)". value. = End of price with
Comments
Post a Comment