View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Function (array argument, range argument, string argument) vba

Not sure I understand, so I'll just throw this out. Are there any ideas
here that would help?

Option Explicit
Public NewArray() As String

Function FillArray(ParamArray v())
Dim n As Long
Dim p As Long

' How many elements?
n = UBound(v) - LBound(v) + 1
ReDim Preserve NewArray(1 To n)

'// Keep track of 1-Based vs. 0-Based Arrays
For p = 1 To n
NewArray(p) = v(p - 1)
Next p
End Function

Sub First_Sub()
FillArray "Cat", "Dog", 3.14, Sqr(2), "More_Text", "etc"
End Sub

--
Dana DeLouis
Win XP & Office 2003


<Witek wrote in message ...
Hi,

Long time .... ok no tears.

Problem:
I would like to write Function with many argument:
array, range, string, double etc,

Public newarray() as String

Function fillArray(varArray1() as Variant, _
optional select1 as Range, arg1 as Single)

dim i as single
for i=0 to 5000
newarray(i)=i+arg1
next i
end Function

I call this function with Sub Procedure
sub firstsub()
fillArray fillArray,
end sub
I'm siting many weeks and nothing, I read many FAQ,
but all post have only one (array) argument.
tx for help
Witek

*** Sent via Developersdex http://www.developersdex.com ***