Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
segregating passed range by rows and columns
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
segregating passed range by rows and columns
What are your constraints. Will it always be columns first, then rows
second. Will there always be an even number and half would be columns, half would be rows. Or do you want the code to assess the commonality and if so, what can be assumed. -- Regards, Tom Ogilvy "Michael Malinsky" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ClearContents method on a passed range | New Users to Excel | |||
Segregating a Search String | Excel Discussion (Misc queries) | |||
Translate range name passed as string to a custom function to range addresses! | Excel Programming | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming |