0
Function SubNSum(a As Double, c As Double, rng As Range) As Double
Dim x As Double
Dim y As Double
Dim z As Double
'Dim b As Double
'b = 0
'q-d>=o and <=f2
    For Each Cell In rng
        'x = a - c
        x = Cell.Value - a
        If ((x > 0) Or (x = 0)) Then
            If ((x < c) Or (x = c)) Then
                'b = b + 1
                y = Cell.Row
                z = Cell.Column
                Cells(y, z - 1).Value = Cells(y, z - 1).Value + x
            End If
        End If
    Next Cell
    'SubNSum = b
End Function
BigBen
  • 46,229
  • 7
  • 24
  • 40
Rob Jr.
  • 1
  • 4

0 Answers0