Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Create range in udf

Hello
Is it possible for a UDF to dimension a named range to work with inside a UDF,
I need to create a named range so I can pass it into the sumifs function
withing the UDF. I have all the other args for the sumifs but arg1 is dynamic
and this is the bit i'm stuck on.

This is what I have so far.
....
Dim SearchColumn As Range
....
SearchColumn = ???? (To be Sheets(1).Range(cells(1,x%),cells(y%,x%))
....
result = WorksheetFunction.SumIfs(SearchColumn, Column1Range,
Column1Criteria, Column2Range, Column2Criteria)
....
ICTSumIf = result


Any ideas
Thanks





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Create range in udf

udf can reference (read) anything in any workbook, but has limited write
capabilities. I like to pass ranges in to UDF's.


=myfunction(A1:B4)
or
=myfunction(columns(1:3))

function myfunction(Myrange as Range)

for each cell in Myrange
.your code
next cell

result = WorksheetFunction.SumIfs(MyRange, Column2Criteria)



end function
"Cresta" wrote:

Hello
Is it possible for a UDF to dimension a named range to work with inside a UDF,
I need to create a named range so I can pass it into the sumifs function
withing the UDF. I have all the other args for the sumifs but arg1 is dynamic
and this is the bit i'm stuck on.

This is what I have so far.
...
Dim SearchColumn As Range
...
SearchColumn = ???? (To be Sheets(1).Range(cells(1,x%),cells(y%,x%))
...
result = WorksheetFunction.SumIfs(SearchColumn, Column1Range,
Column1Criteria, Column2Range, Column2Criteria)
...
ICTSumIf = result


Any ideas
Thanks





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
How do I create a Range Name? Curious New Users to Excel 7 December 14th 07 09:13 PM
How do I create this range? monica Excel Programming 5 May 8th 06 03:43 PM
Create named range Matee Excel Programming 1 April 4th 06 03:40 AM
Create/copy combo boxes in one range if condition is met in a different range LB[_4_] Excel Programming 4 September 30th 05 12:21 AM
Create named range Robert[_16_] Excel Programming 2 October 27th 03 11:57 PM


All times are GMT +1. The time now is 08:30 AM.

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"