Sub PasteArrayToSheet()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("貼り付け先のシート名") ' 貼り付け先のシート名を設定
Dim arr As Variant
arr = ExtractRowsStartingWithOne() ' 関数から2次元配列を取得
If Not IsEmpty(arr) Then
Dim startCell As Range
Set startCell = ws.Range("貼り付け開始セル") ' 例: "A1"
' 貼り付ける範囲を計算
Dim endRow As Long
endRow = startCell.Row + UBound(arr, 1) - 1
Dim endColumn As Long
endColumn = startCell.Column + UBound(arr, 2) - 1
Dim endCell As Range
Set endCell = ws.Cells(endRow, endColumn)
' 計算された範囲に配列の内容を貼り付け
ws.Range(startCell, endCell).Value = arr
End If
End Sub
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme