Below is a rather simple formula which is filled into cell B4 by means of a macro.
Works just fine, but there is one thing
I would like to get adjusted
The second cell reference in this formula 'N42' is not fixed but dynamic.
It could be 'N42' in one case, in another computation case it is 'N17'.
The column letter stays the same but the row index can change. In all of the cases the dynamic cell reference is always the very last used cell
in the column 'N' (Range("N65536").End(xlUp)
So how should the below macro be tweaked to accommodate this requirement?
Help is much appreciated. Thank you very much in advance. Regards, Andreas
Dim strFormula As Variant
strFormula = _
"=IF(N2<>N42,""A total of "" & "" "" &N2-N42& "" Products have not been properly counted!"")"
ActiveWorkbook.Sheets("Results").Range("B4").Formula = strFormula