As far as UBound goes, the manual explains it well.
 Quote:
UBOUND
Action
Returns the largest available subscript for one of the dimensions of an array.

Syntax
UBOUND (array, dimension)

Parameter
Array
The array you want to know the upper boundary of.
Dimension
Optional parameter indicating the dimension of the array you want to know the upper boundary of. The default is 1.

What part of that do you need help with?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.