このコードから「コンパイルエラー:期待される関数または変数」が表示されます
Cells(3, 2).Select
ActiveCell.FormulaR1C1 = Formula 'Inserts formula
'Copies formula across the row
Cells(3, 2).Copy
Range(Cells(3, 2), Cells(3, 10)).PasteSpecial xlPasteFormulas
Range(Cells(3, 2), Cells(3, 10)).Select
'Copies the formula down to end of list
selection.Copy '<---- Here it says it can't compile
Range(selection, selection.End(xlDown)).FillDown
ここで「選択」を使用するとエラーが発生しますが、別のブックで機能します。数式をセルに挿入し、範囲全体にコピーして、データブロックの最後まで入力しようとしています。どうすればそれを再び機能させることができますか?または、セルの範囲に数式を入力する別の方法があります(これは頻繁に変更されるため、変数に入れます)。
サミュエル・スミス、助けてくれてありがとう