Tom Ogilvy - Need a little change

M

Maxi

Thats great

There would be one more change required then.

The following is only applicable for a combination of 10 numbers. For
6, it would be different.
sArr = "{4,10;5,30;" & _
"6,120;7,1000;" & _
"8,11000;9,80000;" & _
"10,2000000}"
v5a = Evaluate(sArr)

Can I define something like:

sArr2 = "{xxxxxxxxxxxxxxxx}"
sArr3 = "{xxxxxxxxxxxxxxxx}"
sArr4 = "{xxxxxxxxxxxxxxxx}"
sArr5 = "{xxxxxxxxxxxxxxxx}"
sArr6 = "{xxxxxxxxxxxxxxxx}"
sArr7 = "{xxxxxxxxxxxxxxxx}"
sArr8 = "{xxxxxxxxxxxxxxxx}"
sArr9 = "{xxxxxxxxxxxxxxxx}"
sArr10 = "{xxxxxxxxxxxxxxxx}"
v5a = Evaluate(sArr & iComb)

Is this the correct way or is there a better way?

One more question, currently the SArr values are whole numbers
(10,30,120,1000,11000,80000,2000000). If these values have decimals
like (10.25,30.5,120.75,1000,11000,80000,2000000) then I feel just
changing Dim v3a() As Long to Dim v3a() As Currency would do the job. I
read this in excel help files. Is this correct?

Thanks
Maxi
 
T

Tom Ogilvy

Is this the correct way or is there a better way?
Looks as good as any.

sArr is a string

v5A would need to stay variant. It would still allow you to have doubles or
singles. I don't see any reason to use currency.

I would expect the numbers in v5a are doubles already

just to demonstrate:

Sub BB()
sArr = "{4,10;5,30;" & _
"6,120;7,1000;" & _
"8,11000;9,80000;" & _
"10,2000000}"
v = Evaluate(sArr)
Debug.Print TypeName(v(1, 1)), TypeName(v(1, 2))

End Sub

produces:

Double Double

numbers in cells are stored as double and evaluate is essentially a virtual
cell.
 

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