excel - Selecting a group of cells up in a range -


I have next loop which takes each cell in a category, says 10 below, calculates those ten Is cells and results in the next column. This will take cell A1 for example, zodiac A1-A10 and put it in result B1. It then has a hole in A2, gives the amount to A2-A11 and puts the result in B2. The following code (fraction only) works fine.

I want to move UP downwards. Select cell A20, use A20-A10, and insert the results into B-20. The following code will have a value of 10 for E1, and each cell has the number of cells selected from the category.

  Range for each RNG ("LogRd1") Rng Selection selection values ​​() () (1). Select RNG Offset (, 1). Formula = ((Application Worksheet. Sum (Selection)) / ((Range ("E1"). Value + 0.0001) - (Application.WorksheetFunction.Sum (Selection)) Next RNG   

Any help was appreciated. Thanks, Grant

Re-edited : as a bit more robust range as a dim dim RNG in the form of dim BLOCK_SIZE as dim BLOCK_SIZE, in the form of range, as in Variant BLOCK_SIZE = "Range" ("E1" ) Value for each Rng in range ("LogRd1") Rng.Row> = BLOCK_SIZE then set r = Rng.Offset (- (BLOCK_SIZE-1), 0). Resize (BLOCK_SIZE, 1) s = Application.Sum (r) if not, then error (s) RNG. (0, 1) .Value = S / ((BLOCK_SIZE + 0.0001) - s) Other RNG. (0, 1). Value = "Problems!" End If End If 'BLOCK_SIZE RGG to start

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -