CLng

This function converts an expression to a Variant of subtype Long.

Syntax

CLng(expression)

Parameters

expression
Any valid expression.

Return Values

Returns a Variant of subtype Long.

Remarks

Use CLng to force currency arithmetic in cases where using expression directly would result in a type mismatch or other error.

If expression lies outside the acceptable range for the Long subtype, an overflow error occurs.

CLng differs from the Fix and Int functions, which truncate rather than round the fractional part of a number. When the fractional part is exactly 0.5, CLng always rounds it to the nearest even whole number. For example, 0.5 rounds to 0 and 1.5 rounds to 2.