I have used this code below which copies a range of data from one workbook to another, which works fine. I want to take this to another level. How can I copy data from a workbook to another workbook, but not knowing where the last row is
Code:
Sub copyDataToOtherWorkbook()
Dim wbTo As Workbook
Dim wbFrom As Workbook
Set wbFrom = ThisWorkbook
Application.ScreenUpdating = False
Set wbTo = Workbooks.Open("F:\DataDatabase.xls", False, False)
With wbTo.Sheets("Database")
.Range("Data").Value = wbFrom.Sheets("DataFrom").Range("DataPaste").Value
.Close True
End With
MsgBox "All Data Updated"
Application.ScreenUpdating = True
Set wbTo = Nothing
Set wbFrom = Nothing
End Sub
How can I do this?