![]() |
some code sets a variable to a sumif formula, offset 2
There is a sheet that is gives updated figures called dct_count.xls. Then
there is the active sheet I'm trying to update. The dct count sheet column E:E is updated with column d of active sheet. I can't quite understand the code. There is a sub-routine that sub-totals 3 of the columns including the DCT's D column. First it initializes it to 0. Then sets column D for each sub-total range to this sumif formula and the offset is 2? There is a column H with service groups. There are 2 other columns, as well as the dct column, that are sub-totaled after each service group range. Set DCT_Count_Range = Intersect(Workbooks("dct_count.xls").Sheets("dct_c ount").Range("E:E"), Workbooks("dct_count.xls").Sheets("dct_count").Use dRange) DCT_Count_Range.Replace What:=" ", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Application.ScreenUpdating = False Application.Calculation = xlCalculationManual For Each C In Intersect(Range("D12:D64000"), ActiveSheet.UsedRange) DCT = 0 DCT = Application.WorksheetFunction.SumIf(DCT_Count_Rang e, C.Value, DCT_Count_Range.Offset(0, 2)) C.Offset(0, 2).Value = DCT Next C Application.Calculate Set Streams_Needed = Intersect(Range("G12:G64000"), ActiveSheet.UsedRange) Question: What is the calculation here? Is it setting the last cell in the C range to be the sumif formula....... so that it will calculate the sub-total for each service group and then it is told to calculate? The sub-total row gets removed by a subroutine and then added back after each update process I may be wrong on this supposition because in the sub-total routine it adds 3 columns on the active sheet including DCT and it appears to be setting the formula at the end of each service group to sub-total the 3 columns using sumif formulas. So if it is doing it there what is it doing here? I don't understand what the 2 row offset does? For example, say it is in the last row of the first service group doing a comparison then wouldn't it be an offset of 1 or does it count the row it is currently on and then one down and that would be 2? It sets the range for the streams needed for a sub routine that is called next. Maybe if I can understand this then I can understand the sub-routine and why there is a mistake in only one range for one of the sub-totals. tia, |
All times are GMT +1. The time now is 12:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com