I have following formula in Excel, where I applying countif with dynamic range. When I apply this formula in macro, this is not giving value instead single quote (') is covering the range.
Cells(XRow, 3).Formula = "=COUNTIF( " & Range(Cells(6, 5), Cells(YRow - 1, 5)).Address(0, 0) & " ,RC[-1])"
This is what I get in cell
=COUNTIF( 'E6':'E212',B6)
I am not sure why single quote occupy the cell 'E6', If I remove ' manually from cell, it works. Any help would be much appreciated.