は、私は頻繁にコピー&ペーストする機能
その後
Function CountRows(r as Range) As Long
CountRows = r.Worksheet.Range(r,r.End(xlDown)).Rows.Count
End Function
を使用しているあなたは、この
Dim N as Long
Dim r_dst as Range, r_src as Range
' Pick first cell on sheet 1
Set r_dst = Sheet1.Range("A1")
' Count existing data and move to end
N = CountRows(r_dst)
Set r_dst = r_dst.Offset(N,0)
' Pick first cell of sheet 2 and count rows
Set r_src = Sheet2.Range("A1")
N = CountRows(r_src)
' Copy rows to sheet 1
CopyRange r_src, r_dst, N, 2
' Move to end of data on sheet 1
Set r_dst = r_dst.Offset(N,0)
' Pick first cell on sheet 2 and count rows
Set r_src = Sheet3.Range("A1")
N = CountRows(r_src)
' Copy rows to sheet 1
CopyRange r_src, r_dst, N, 2
のようにそれを使用
Sub CopyRange(r_src as Range, r_dst as Range, numrows as Long, numcols as Long)
r_dst.Resize(numrows,numcols).Value2 = r_src.Resize(numrows,numcols).Value2
End Dub