I've managed to do what I set out to, which is to put a relative formula in each of the cells in a range in a table using the following section of code:
With ActiveWorkbook.Sheets("Project Select")
lastcol = .Cells(i, .Columns.Count).End(xlToLeft).Column
End With
Do Until x = lastcol
Cells(i, x).FormulaR1C1 = "=iferror(INDEX(addhours[Hours],MATCH(psbuild[[#This Row],[Column1]],addhours[Name],0),MATCH('Project Select'!R6C,addhours[Date],0),1),"")"
x = x + 1
Loop
ActiveCell.Offset(1, 0).Select
Loop
However, as some of the cell values being returned are blank, I get #N/A returned.
If I change to the following
Cells(i, x).FormulaR1C1 = "=IFERROR(INDEX(addhours[Hours],MATCH(psbuild[[#This Row],[Column1]],addhours[Name],0),MATCH('Project Select'!R6C,addhours[Date],0),1),"")"
the formulas stop being put in any of the cells in the range.
Putting the iferror formula into each cell manually works though.
Anybody know why cos it's killing me
Bookmarks