Jun 30 2023 01:35 PM
Hi,
Please let me know if I am missing something.
'Find the next available row in the destination sheet
nextRow = destinationSheet.Cells(destinationSheet.Rows.Count, 1).End(xlUp).Row + 1
Instead of going to the first row, its going to the second row.
Please see attached screencapture.
Thanks for the help!
Jun 30 2023 02:15 PM
If the entire column is still empty, destinationSheet.Cells(destinationSheet.Rows.Count, 1).End(xlUp).Row will be 1, so if you add 1 you end up with 2.
You could use
Dim rngLastCell As Range
Set rngLastCell = destinationSheet.Cells(destinationSheet.Rows.Count, 1).End(xlUp)
If rngLastCell.Value = "" Then
nextRow = 1
Else
nextRow = rngLastCell.Row + 1
End If
Jun 30 2023 05:16 PM
Jun 30 2023 11:00 PM - edited Jun 30 2023 11:01 PM
The code that I posted should replace the code that you included in the first post. How you use nextRow is up to you.
The code calculates nextRow correctly - I tested it. What is the problem you're having with it?
Jun 30 2023 11:51 PM
Jul 01 2023 11:09 PM
Could you attach a sample workbook that demonstrates the problem (without sensitive data), or if that is not possible, make it available through Google Drive, OneDrive, Dropbox or similar?