bi-dimensional arrays

I

ina

hello guys, i have a problem with an bi-dimensional array.


This is my code

I declared a array

dim fee(1 to 2, 1 to 4) as string
Dim i as integer


Fee(1, 1) = "mgt"
Fee(1, 2) = "admin"
Fee(1, 3) = "mgt_mgt"
Fee(1, 4) = "othersfees"

For i = 1 To 4
'in order to evaluate this formula i need the fee name and client code
StrFormula4 = "Fees(""" & Fee(1, i) & """,""" & Client& """)"
Fee(2,i) = Evaluate(StrFormula4)
Next i

msgbox fee(2,i) ' I
and once the formula evaluate I need the result.



I do not know very well manipulating arrays; could someone help me on
that

Ina
 
P

paul.robinson

Hi
You seem to have a variable called Client so:

function MakeFeeArray(Client as String) as Variant
dim fee(1 to 2, 1 to 4) as string
Dim i as integer, StrFormula4 as String

Fee(1, 1) = "mgt"
Fee(1, 2) = "admin"
Fee(1, 3) = "mgt_mgt"
Fee(1, 4) = "othersfees"

For i = 1 To 4
'in order to evaluate this formula i need the fee name and client code

StrFormula4 = "Fees(""" & Fee(1, i) & """,""" & Client& """)"
Fee(2,i) = Evaluate(StrFormula4)
Next i
MakeFeeArray = Fee

end function

In another sub/function you can then access MakeFeeArray for "Client1"
by
Dim myArrayValues as Variant
myArrayValues = MakeFeeArray("Client1")

and use myArrayValues(1,1) etc

regards
Paul
 
G

Guest

the only problem I can see is you need a space between Client and the ampersand

""",""" & Client& """)"

should be

""",""" & Client & """)"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top