0

I want to apply a formula that is automatically calculated by a column input from an Excel table to a specific column. At this time, since the column to which the formula is applied should appear at the same interval, the following code value is used and an error occurs. What am I doing wrong?

1004 runtime error

For b = 68 To 299 Step 21    
    Cells(2, b).Select        
    ActiveCell.Formula = "=IFERROR" & "([@[" & Cells(1, b - 2).Value & "]] " & "*" & "([@[" & Cells(1, b - 1).Value & "]]" & "/" & "1000000" & ")," & Chr(34) & Chr(34) & ")"        
    Cells(2, b).Select        
    Selection.AutoFill Destination:=Range("table1" & "[" & Cells(1, b) & "]")
Next b

cells(1,b) => table Header
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
jayson
  • 1
  • First thinng you should do is to read [How to avoid using Select in Excel VBA](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba) and use this technique in your code. – Pᴇʜ Apr 04 '19 at 06:20
  • Forget the code for a moment. manually try and put the formula in the first cell of that range. And then share the formula here. – Siddharth Rout Apr 04 '19 at 06:26

0 Answers0