選択したすべてのシートに行を挿入し、一部の値を別のシートの値と等しくなるように設定するマクロを作成しています。次のコードを使用して行を挿入できましたが、値を設定しようとして行き詰まりました。マクロを使用しない場合=InputC7
は、ワークブックの最初のシートの名前である Input と入力するだけです。
Sub InsertRows()
'
' InsertRows Macro
' Inserts rows into all selected sheets at the same position
'
Dim CurrentSheet As Object
' Loop through all selected sheets.
For Each CurrentSheet In ActiveWindow.SelectedSheets
' Insert 1 row at row 7 of each sheet.
CurrentSheet.Range("a7:a7").EntireRow.Insert
CurrentSheet.Range("c7").Value =Input!C7 'this is not working
Next CurrentSheet
End Sub