Want to place the given formula in 5 cells
'////j and p have been declared before as Double
For j = 5 To 9
p=j*4
Worksheets("Sheet1").Activate
Sheets("Sheet1").Cells(j, 5 + (3 * n) + 1 ).Select
ActiveCell.FormulaR1C1 = "=IFERROR(IF(ROW(RC[p])<255,""DATA N/A"",INDIRECT(ADDRESS(ROW(RC[p])-250,COLUMN(RC[p]),,,))/RC[p]-1),""DATA N/A"")"
Next j
There is a Run Time 1004 error in the ActiveCell.... line . I am unable to debug the error. Someone please help.
You don't actually want the string 'p' to appear in your formula. I've no idea if your formula is valid btw.
Sub x()
Dim j As Long, p As Long, n As Long
For j = 5 To 9
p = j * 4
Worksheets("Sheet1").Cells(j, 5 + (3 * n) + 1).FormulaR1C1 = "=IFERROR(IF(ROW(RC[" & p & "])<255,""DATA N/A"",INDIRECT(ADDRESS(ROW(RC[" & p & "])-250,COLUMN(RC[" & p & "]),,,))/RC[" & p & "]-1),""DATA N/A"")"
Next j
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.