質問: lastRow + 1 sh1.Range("D3")=sh2.Cells(lastRow, 3) sh1.Range("F3")=sh2.Cells(lastRow, 6) sh1.Range("G3")=sh2.Cells(lastRow, 7) msgbox"転記が完了しました" End Sub
回答: Sub 一覧表転記() Dim lastRow As Long Dim sh1 As Worksheet, sh2 As Worksheet Set sh1 = Worksheets("Sheet1") Set sh2 = Worksheets("Sheet2") If sh1.Range("D13").Value = "" Then Exit Sub End If lastRow = sh2.Cells(Rows.Count, 2).End(xlUp).Row sh2.Cells(lastRow, 3).Value = sh1.Range("D3").Value sh2.Cells(lastRow, 6).Value = sh1.Range("F3").Value sh2.Cells(lastRow, 7).Value = sh1.Range("G3").Value MsgBox "転記が完了しました" End Sub