Hi - I can't seem to get the ISERROR to work in VBA.
Numerator = X
Denominator = Y
Fraction = X/Y
X and Y varies in my macro (loops through loads of data). Sometimes Y will be zero and my macro fails.
I want to apply the IF(ISERROR function: Fraction = IF(ISERROR((X/Y),0,(X/Y)). But I only get run-time error or Division by zero error message.
Does this only work if you actually have a "physical" cell in a sheet that calculates X/Y returning #DIV/0! evaluated to TRUE using ISERROR? Or should it be possible using "virtual" variables in VBA too? (X and Y reads from a sheet but X/Y is not in my sheet, only a line of code in my modul. Thanks.
Numerator = X
Denominator = Y
Fraction = X/Y
X and Y varies in my macro (loops through loads of data). Sometimes Y will be zero and my macro fails.
I want to apply the IF(ISERROR function: Fraction = IF(ISERROR((X/Y),0,(X/Y)). But I only get run-time error or Division by zero error message.
Does this only work if you actually have a "physical" cell in a sheet that calculates X/Y returning #DIV/0! evaluated to TRUE using ISERROR? Or should it be possible using "virtual" variables in VBA too? (X and Y reads from a sheet but X/Y is not in my sheet, only a line of code in my modul. Thanks.