I\'m trying to go through a range of cells in a worksheet and write a formula in each one. But I keep getting the error:
Run-time error \'1004\'
Application-de
Error was in the string:
Worksheets("Rawdata1").Cells(row, col).FormulaR1C1 = "=IF(Numbers1!$E$" & col & "<>0;Numbers1!" & "$" & strColCharacter & "$" & row & ";"""")"
Should have been:
Worksheets("Rawdata1").Cells(row, col).FormulaR1C1 = "=IF(Numbers1!$E$" & row & "<>0;Numbers1!" & "$" & strColCharacter & "$" & row & ";"""")"
Targeting the row, not the column.
Your problem is with .FormulaR1C1. This tells the formula to expect a Row Number, Column Number style formula reference, but then you give it an address (Column, Row) style formula.
Change .FormulaR1C1 to .Formula