Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
開いているワークブックから別の開いているワークブックにセルをコピーするためのマクロ...ファイルパスがわからない場合 PS:コードはソースワークブックに記述されます
次のようなものが必要です(ThisWorkbookVBAコードを持っているワークブックへの参照です):
ThisWorkbook
ThisWorkbook.Worksheets("Sheet1").Range("A1:B2").Copy Workbooks("Book1.xslx").Worksheets("Sheet1").Range("A1").Insert Shift:=xlDown
両方のワークブックが既に開かれていると仮定します。フル パスを知る必要はありません。重要なのはファイル名だけです。