I'm trying to copy the data from one sheet to the last row of another sheet.
The reason why I am doing this is because I want to consolidate the data in a sheet which is already existing and my contain already a data.
Below is my code so far which only copies again to the A2 of another sheet. What approach should I do for this:
Sub Upload()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
Dim MainPage As Worksheet
Set MainPage = Sheets("Main")
Dim r As Long
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set Wb1 = ActiveWorkbook
FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a File", _
filefilter:="Excel File *.xlsx (*.xlsx),")
If FileToOpen = False Then
MsgBox "No File Specified.", vbExclamation, "ERROR"
Exit Sub
Else
Set Wb2 = Workbooks.Open(Filename:=FileToOpen)
With Wb2.Sheets("ALL TICKETS (excpt Open-OnHold)")
srcLastRow = .Range("A:AJ").Find("*", SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row
destLastRow = Wb1.Sheets("ALL TICKETS (excpt Open-OnHold)".Range("A:AJ").Find("*", SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row + 1
Wb1.Sheets("ALL TICKETS (excpt Open-OnHold)").Range("A2:AJ" &
destLastRow).Value = .Range("A2", "AJ" & srcLastRow).Value
End With
Wb2.Close
End If
End Sub