View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ksnapp[_25_] ksnapp[_25_] is offline
external usenet poster
 
Posts: 1
Default Combine two udfs into an array

the first evaluates a column of text and give a conditional sum of th
column to the right, then next udf gives a contitional sum of the nex
column to the right

I want to highlight one or two cells and the range to be evaluated (a
I do now with both of these udf) but I want the answer to first udf i
the active cell, and the answer to the second in the cell to its right

here is the first udf

Function asdf(myRange As Range) ' UDF to give total tran count
Dim T As Double
Dim myCell As Range
T = 0
For Each myCell In myRange
CaseText = myCell.Value
Select Case (CaseText)
Case Is < "TOTAL ACCOUNTS"
T = T + myCell.Offset(0, 1).Value
End Select
Next myCell
asdf = T
End Function

here is the second

Function qwer(myRange As Range) ' UDF to give total tran count
Dim T As Double
Dim myCell As Range
T = 0
For Each myCell In myRange
CaseText = myCell.Value
Select Case (CaseText)
Case Is < "TOTAL ACCOUNTS"
T = T + myCell.Offset(0, 2).Value
End Select
Next myCell
asdf = T
End Function

as you can see there almost identical I just have no idea on how t
make it an array formul

--
Message posted from http://www.ExcelForum.com