Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Pass a Variable List Of Values To Subroutine or Function

Hello All,

What I want to do is create a function (maybe subroutine) that will be
passed a variable number of values and perform some processing. I am not
sure this is possible because the functions I have created in the past has a
finite number of parameters.

Has anyone done this?

Thanks in advance.

Dean.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Pass a Variable List Of Values To Subroutine or Function

I do this frequently. Look at "Understanding Parameter Arrays" in VBA
Help



In article ,
"Dean Hinson" wrote:

What I want to do is create a function (maybe subroutine) that will be
passed a variable number of values and perform some processing. I am not
sure this is possible because the functions I have created in the past has a
finite number of parameters.

Has anyone done this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Pass a Variable List Of Values To Subroutine or Function

Take a look at ParamArray in VBA help, just what you need. Here is a simple
example

Public Function weightedstdev(ParamArray rng())
Dim rngCount
rngCount = UBound(rng, 1)
For i = 0 To rngCount
' your code
Next
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dean Hinson" wrote in message
...
Hello All,

What I want to do is create a function (maybe subroutine) that will be
passed a variable number of values and perform some processing. I am not
sure this is possible because the functions I have created in the past has

a
finite number of parameters.

Has anyone done this?

Thanks in advance.

Dean.



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
Call a subroutine using variable subroutine name dhstein Excel Discussion (Misc queries) 3 July 26th 09 08:28 PM
pass variable from one workbook to another calebjill Excel Discussion (Misc queries) 2 January 28th 09 07:38 PM
Pass variable to NORMINSV function to get only mean value ExcelMonkey Excel Worksheet Functions 3 June 19th 06 06:01 PM
How to pass a workshhet name as a parameter into a subroutine ? yigalb Excel Discussion (Misc queries) 4 January 9th 05 10:28 AM
system variable representing subroutine name? Bob Kilmer Excel Programming 0 July 9th 03 12:30 AM


All times are GMT +1. The time now is 08:11 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"