- ベストアンサー
VBAで別シートの必要データの値をコピーし貼付け
- みんなの回答 (1)
- 専門家の回答
質問者が選んだベストアンサー
参考に Sub Test() Dim ws1 As Worksheet, ws2 As Worksheet Dim LR1 As Long, LR2 As Long Dim h As Long Set ws1 = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") LR1 = ws1.Cells(Rows.Count, "C").End(xlUp).Row LR2 = ws2.Cells(Rows.Count, "B").End(xlUp).Row h = LR2 - 5 ws1.Cells(LR1 + 1, "A").Resize(h, 2).Value = ws2.Cells(6, "B").Resize(h, 2).Value ws1.Cells(LR1 + 1, "C").Resize(h, 2).Value = ws2.Cells(6, "E").Resize(h, 2).Value ws1.Cells(LR1 + 1, "E").Resize(h, 1).Value = ws2.Cells(6, "H").Resize(h, 1).Value End Sub