I am getting a Run-Time Error '1004' based on the bottom line of code. If I "end" and Re-run, the problem does not come up.
I have only included the relevant code as I have a lot of variables, if's and formatting code.
Dim Yeild As String
Sub NewPage()
'...
Yeild = "=INDEX(AcreGrid,MATCH(" & Chr(34) & Comm & Chr(34) & _
",Prod!R3C1:R30C1,),MATCH(" & Chr(34) & Season & Chr(34) & _
",Prod!R3C1:R3C16,))/" & ActiveCell.Offset(0, 3)
'... the above formula has been giving me the most problems
ActiveCell.Offset(0, 3).Formula = "=Vlookup(B" & ActiveCell.Row & ", EQF,5,)" 'Factor
'... I didn't define the above formula because it was causing problems
ActiveCell.Offset(0, 7) = Yeild
'...
End Sub
I have also tried the following but the Cell Reference B4 changes to 'B4'; causes a #NAME? error in Excel.
Yeild = "=INDEX(AcreGrid,MATCH(" & Chr(34) & Comm & Chr(34) & _
",Prod!R3C1:R30C1,),MATCH(" & Chr(34) & Season & Chr(34) & _
",Prod!R3C1:R3C16,))/Vlookup(B" & ActiveCell.Row & ", EQF,5,)"
ActiveCell.Offset(0, 7) = Yeild
Any help would be greatly appriciated.
Dim Yeild As Stringinto the sub. I would also putOption Explicitat the top of your module...Yeild? Its probably not what you think. Use a BreakPoint orDebug.Print Yeildto see what's actually there before you try to assign it into a Formula.