All DIM declarations must be in the FUNCTION or SUB before the first executable command.
DIM fTimeDiff2 AS Float DIM iTest AS Integer DIM iK[9] AS Integer ' ik[0] to ik[8] DIM shX[3,3] AS Short DIM date1 AS Date iTest = 8