VBA Migration


VBA.Abs

ABS - Returns the absolute value of a number.


VBA.CSng

Dim sNumber As String 
Dim sngValue As Single
sNumber = "40"
sngValue = CSng(sNumber)

// TypeScript
let sNumber: string;
let nValue: number;
sNumber = "40";
nValue = Number(sNumber);

VBA.Fix

FIX - Returns the integer portion of a number.


VBA.Int

INT - Returns the number rounded down to the nearest integer.

Int(3.4) 
Math.floor(3.4)

VBA.IsNumeric

If (IsNumeric(sValue) = True) Then 

// JavaScript
if ('typeof (sValue) === "number) == true)

VBA.Mod

10 Mod 3 

// JavaScript
10 % 3

VBA.Round

ROUND - Returns a number rounded to a given number of decimal places.

dbValue = 0.9 
VBA.Round(dbValue, 1)
dbValue = 0.169
VBA.Round(dbValue, 2)

'// JavaScript
dbValue.toFixed(1);
Math.round(dbValue) // 1 decimal place
dbValue.toFixed(

VBA.Rnd

RND - Returns a random number between 0 and 1.

Rnd() 
Math.random();

VBA.Sgn

SGN - Returns the sign of a number.



© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrev