Forum Discussion
Debug Error on Macro
- Feb 21, 2019
ROUNDDOWN is a built-in function. The use of it is
=ROUNDDOWN(number, num_of_digit)
The macro you wrote is a procedure to repeatedly insert function/formula into the cell in column U. So, it is not related to whether macro recognize ROUNDDOWN
You may try to change the num_of_digit parameter to see if it works. I thought ROUNDDOWN(A1,0) will gives a value round down to the nearest integer.
I think you want to type a formula in excel like the following:
= IF(Criteria,1,"")
The cell will be blank when the criteria is not true.
However, the use of "" in VBA in a string will be viewed as one quotation (in order to distinguish with the string end). So you need to change the VBA statement as
Range("$AZ30").Formula = "=IF(($S30 > 0)*($R30 > 0), $U30=$S30,"""")"
You may also try chr(34) for the use of quotation mark in .formula.
Range("$AZ30").formula = "=IF(($S30 > 0)*($R30 > 0), $U30 = $S30," & chr(34) & chr(34) & ")"
Hope that it is helpful.
Thank you Man Fai Chan,
I tried both suggestions. Both formulas left a dashs "---" in place of the "false".