M
Michael Malinsky
I have the following:
Function MySum(ParamArray argumentArray() As Variant) As Double
Dim argumentCount As Integer
Dim cell As Range
Dim i As Integer
Dim sum As Double
sum = 0
argumentCount = UBound(argumentArray)
For i = 0 To argumentCount
For Each cell In argumentArray(i).cells
sum = sum + cell.Value
Next
Next i
cfoot = sum
End Function
This works fine for summing a non-continuous range of cells. However, what
I'd like to do is segregate the cells by row and column so if I used the
following formula:
=mysum(C3,C7,A9,B9)
The function would segregate the numbers in column C from those in row 9. I
basically want to limit the user to selecting info from one row and one
column then sum the values from the cells in the row and comparing to the
sum of the values in the column. For those of you familiar with the
terminology, I want to create a function that will crossfoot a column and a
row to verify that the sums match, except I want to do this for
noncontinuous cells in the row and/or column.
TIA.
--
Michael J. Malinsky
Pittsburgh, PA
"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh
Function MySum(ParamArray argumentArray() As Variant) As Double
Dim argumentCount As Integer
Dim cell As Range
Dim i As Integer
Dim sum As Double
sum = 0
argumentCount = UBound(argumentArray)
For i = 0 To argumentCount
For Each cell In argumentArray(i).cells
sum = sum + cell.Value
Next
Next i
cfoot = sum
End Function
This works fine for summing a non-continuous range of cells. However, what
I'd like to do is segregate the cells by row and column so if I used the
following formula:
=mysum(C3,C7,A9,B9)
The function would segregate the numbers in column C from those in row 9. I
basically want to limit the user to selecting info from one row and one
column then sum the values from the cells in the row and comparing to the
sum of the values in the column. For those of you familiar with the
terminology, I want to create a function that will crossfoot a column and a
row to verify that the sums match, except I want to do this for
noncontinuous cells in the row and/or column.
TIA.
--
Michael J. Malinsky
Pittsburgh, PA
"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh