ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   bi-dimensional arrays (https://www.excelbanter.com/excel-programming/360027-bi-dimensional-arrays.html)

ina

bi-dimensional arrays
 
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


[email protected]

bi-dimensional arrays
 
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


Tom Ogilvy

bi-dimensional arrays
 
the only problem I can see is you need a space between Client and the ampersand

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

should be

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

--
Regards,
Tom Ogilvy


"ina" wrote:

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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com