Hi,
I have the following code
[code]
Dim LastRow As Long
Dim a As Long
..
..
..
a = [SUMPRODUCT(1/COUNTIF(Sheet1!O2:O5065,Sheet1!O2:O5065))]
Worksheets("Sheet2").Range("D2").FormulaArray = "=IFERROR(INDEX(Sheet1!$O$2:$O$5065, MATCH(0,COUNTIF($D$1:D1, Sheet1!$O$2:$O$5065), 0)),"""")"
[\code]
the variable, LastRow, is the value of last row in my spreadsheet, which is 5065. I was wondering how to replace the 5065 in each of these lines with a reference to the variable, LastRow
Thanks!!
Bookmarks