From: OssieMac on
I have not tested any of your code but I wonder if you have Option Base 1 set
so that the array elements number from 1 and not from zero.

Actually when dimensioning arrays it is a good idea to set the array base
when dimensioning instead of using Option Base 1 like the following.

Dim deg(1 to 12), min(1 to 12)

then for the 2 dimension arrays

DEGt(1 to 24, 1 to 2) As Double

The above method ensures that the first element number is 1. It also makes
the code transportable to any module without having to remember the Option
Base 1 and it is also possible to have both types of dimensioning in the code.


--
Regards,

OssieMac


From: OssieMac on
Having a closer look at your code I cannot come to grips with what you are
attempting to do. You have 2 nested loops which is fine if all are 2
dimension arrays but the arrays with one dimension in For h = 1 To 12 get
assigned first one value then it is over written with the second loop of For
d = 1 To 2.

You should only have one loop from 1 to 12 and the array with 2 dimensions
should be populated with 2 lines of code like the following. (I have used the
element numbers for the second dimension because I don't know what value to
use for Dates - It should be 1 or 2).

For h = 1 To 12
deg(h) = (.Cells(h + 4, 3 + 4 * d))
min(h) = (.Cells(h + 4, 4 + 4 * d))
sec(h) = (.Cells(h + 4, 5 + 4 * d))
DEGt(h, 1) = (deg(h)) + (min(h)) / 60
DEGt(h, 2) = 'Whatever it should equal
Zodiac(h) = .Cells(h + 4, 2 + 4 * (dates - 1))
Next h



--
Regards,

OssieMac


First  |  Prev  | 
Pages: 1 2
Prev: Combo box in user form
Next: Application.UserName