I am looking for some assistance making the code below run for all selected cells in rows 27-67. The code below works for the first row; it copies contents from the selected cells to the next available row on a different worksheet.How can I make it loop through rows 27-67, copying cells from the same columns, to the next available row in the other worksheet? I am a VBA novice and suspect there are a number of different ways to approach this.
Here's the code:
Sub CopyToDATASheet()
Dim src As Worksheet
Dim dst As Worksheet
Dim LastRow As Long
Application.ScreenUpdating = False
' Set source and destination sheets
Set src = Sheets("PRODUCTION")
Set dst = Sheets("table")
' Find next available row on destination sheet
LastRow = Worksheets("table").Range("A" & Rows.Count).End(xlUp).Row + 1
' Populate values on destination sheet
dst.Cells(LastRow, "A") = src.Range("B27")
dst.Cells(LastRow, "B") = src.Range("A27")
dst.Cells(LastRow, "C") = src.Range("F27")
dst.Cells(LastRow, "D") = src.Range("G27")
Application.ScreenUpdating = True
End Sub
Here's the code:
Sub CopyToDATASheet()
Dim src As Worksheet
Dim dst As Worksheet
Dim LastRow As Long
Application.ScreenUpdating = False
' Set source and destination sheets
Set src = Sheets("PRODUCTION")
Set dst = Sheets("table")
' Find next available row on destination sheet
LastRow = Worksheets("table").Range("A" & Rows.Count).End(xlUp).Row + 1
' Populate values on destination sheet
dst.Cells(LastRow, "A") = src.Range("B27")
dst.Cells(LastRow, "B") = src.Range("A27")
dst.Cells(LastRow, "C") = src.Range("F27")
dst.Cells(LastRow, "D") = src.Range("G27")
Application.ScreenUpdating = True
End Sub