Hi All,
I'm currently trying to locate the last 30 data sets of Column "U" located in Sheet1 as well as the corresponding data located in Column "A" of the same row.
I'd like to copy this data into the most empty cells of Sheet 2 where the Column "U" data of Sheet 1 goes into Column "B" empty cells of sheet 2 and the Column "A" data of Sheet 1 goes into the Column "A" data of Sheet 2.
I've attached my current code below. Currently, this does not locate the last data set in the column based off of Column "U" of sheet1 due to my Offset(690) value I believe (Currently there are 689 data sets with one header).
I'm currently trying to locate the last 30 data sets of Column "U" located in Sheet1 as well as the corresponding data located in Column "A" of the same row.
I'd like to copy this data into the most empty cells of Sheet 2 where the Column "U" data of Sheet 1 goes into Column "B" empty cells of sheet 2 and the Column "A" data of Sheet 1 goes into the Column "A" data of Sheet 2.
I've attached my current code below. Currently, this does not locate the last data set in the column based off of Column "U" of sheet1 due to my Offset(690) value I believe (Currently there are 689 data sets with one header).
VBA Code:
Sub Plot()
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lCopyLastRow As Long
Dim lDestLastRow As Long
Dim mainWB As Workbook
Set mainWB = ActiveWorkbook
Set wsCopy = mainWB.Worksheets("Sheet1")
Set wsDest = mainWB.Worksheets("Sheet2")
'Finds the last used row based on Column B and places it in the last empty row of Column A in the Log File
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "B").End(xlUp).Offset(1).Row
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "U").End(xlUp).Offset(690).Row
wsDest.Range("B" & lDestLastRow).Value = wsCopy.Range("U" & lCopyLastRow).Value
wsDest.Range("A" & lDestLastRow).Value = wsCopy.Range("A" & lCopyLastRow).Value
End Sub