Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ClearContents method on a passed range bryan New Users to Excel 2 January 19th 05 08:49 AM
Segregating a Search String RTP Excel Discussion (Misc queries) 1 December 22nd 04 07:04 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM
Error Converting Passed Range into Array in VBA for Excel Alan Beban[_2_] Excel Programming 0 September 1st 04 04:56 PM
Error Converting Passed Range into Array in VBA for Excel Dave Peterson[_3_] Excel Programming 0 September 1st 04 01:17 AM


All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"