Questions tagged [paramarray]

50 questions
2
votes
1 answer

Trouble finding row of element zero of ParamArray

I have an array where in column A different article names are listed. Now I want to add up the values corresponding to some of these article names. Since the number of article names is not constant I am passing the names on as a ParamArray. All of…
Lisa
  • 21
  • 1
2
votes
2 answers

Validate that ParamArray contains the right types of parameters

I'm trying to use ParamArray to pass different kinds of parameters to the same function to mimic Function Overloading. One single String One Workbook object, one String as well as an Integer So user may pass different arguments to the same…
Nicholas Humphrey
  • 1,220
  • 1
  • 16
  • 33
2
votes
2 answers

VBA UDF ParamArray Sequence

I want to create a function that is almost exactly like SumIfs, but I'm having a hard time figuring our how to handle the ParamArray portion. I'm looking for a solution that allows the same Range1,Criteria1,Range2,Criteria2,...,Rangen,Criterian as…
Schalton
  • 2,867
  • 2
  • 32
  • 44
2
votes
0 answers

Excel UDF with ParamArray constraint like SUMIFS

I am trying to code an Excel UDF with a similar syntax to the builtin SUMIFS, that is with a signature like Function myUDF(param1 As Type1, ParamArray paramRest() As Variant) As MyType but the condition that the ParamArray must have an even number…
AlexR
  • 2,412
  • 16
  • 26
2
votes
2 answers

Passing an unknown number of arguments into ParamArray in VBA

I have a function that takes in a ParamArray that I'm trying to pass an unknown number of parameters into. I'm looping through rows and passing in numbers based on if the cells are empty or not, but it seems like I have to pass in each number as its…
KingKong
  • 411
  • 3
  • 10
  • 26
2
votes
1 answer

How to define a function as the sum of all functions in ParraArray in VB.NET

I have a VB.NET function as follows: Public Function Equilibrium(ParamArray F() As Func(Of Double, Double)) As Boolean 'I would like to define a function ' G(x) = sum of all F(x) End Function The parameters of the function are an array of…
N.T.C
  • 658
  • 2
  • 9
  • 20
1
vote
2 answers

Variable number of arguments in ParamArray ArgList()

If I want to pass a number of values for the ParamArray arglist via an array, how do I do it? From what I've read so far, on VBA, it appears that I need to explicitly list the values that I want to pass. But what if there are potentially different…
Excel VBA guy
1
vote
1 answer

Passing Variable # of Arguments to Built-in Functions with ParamArray

I want to create a VBA function which combines several built-in Excel functions, each of which can take one or more cell ranges of different sizes [edit: such as SUM, COUNT, STDEV.P, AVERAGE, MIN, etc; though I would prefer a method that works for…
Gum
  • 11
  • 2
1
vote
3 answers

function that returns all the j-th elements of i given items

I want to write a function that returns all the j-th elements of i given items. The items contain single cells, ranges of cells or both. While it is possible to return all elements (test1), the every first elements (test2), i fail to return the…
rhombuzz
  • 97
  • 10
1
vote
1 answer

Value Error when using UBound for ParamArray

I am trying to write a function that calculates the minimum distance of one zip code to the other. The function should take in the longitude and latitude of one zip code, and then a 2-D array with all longitude and latitude info of zip codes. Here…
Yatong
  • 95
  • 1
  • 1
  • 8
1
vote
1 answer

Paramarray in vbscript

We have a classic ASP that uses a VB6 COM like this: Dim Value1 Dim Value2 Dim Value3 'Etc. Dim VB6COM Set VB6COM = Server.CreateObject("VB6COM") VB6COM.GetSomeValues MyConnectionString, "TABLE_NAME", "ROW_ID = 1", _ "FIELD_NAME_1", Value1,…
Melipao
  • 31
  • 6
1
vote
3 answers

Using ParamArray ByRef

Is there any way to use ParamArray ByRef? Barring that, it there a workaround that accomplishes the same thing? I could do some overloads, but I am trying to avoid the clunkiness. Background: Porting over some old code, and trying to keep the same…
Connor Albright
  • 723
  • 4
  • 13
  • 29
1
vote
1 answer

Two ParamArrays as Parameter in Function

I was just trying to write a function like this: Public Function myGetAttribute(ByVal xmlFileName As String, _ ByVal ParamArray elementV() As String, _ ByVal ParamArray…
ruedi
  • 5,365
  • 15
  • 52
  • 88
0
votes
1 answer

Shorten this into a function

This program organises WMI data into a set of classes - one class for each hardware element in a computer - and each class is initialised multiple times if more than one of a particular hardware element exists. Is there a nice neat way of turning…
Chris Watts
  • 6,197
  • 7
  • 49
  • 98
0
votes
1 answer

My WriteConcatenated method doesn't work because of BC30491

Imports System Module Program Sub WriteConcatenated(ByVal ParamArray TextArr As String()) For I As Integer = 0 To TextArr.Length - 1 For J As Integer = 0 To TextArr.Length - 1 Dim ConcatenatedText =…