I managed to find the solution by surfing on the web.
Sub writeall()
Dim Ws As Worksheet
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Dim X As Long
Dim Y As Long
Dim count As Long
Application.ScreenUpdating = False
Set Ws = ActiveWorkbook.Worksheets(1)
Set Ws1 = ActiveWorkbook.Worksheets(2)
Set Ws2 = Workbooks("xxxx.xlsx").Sheets("2017") ' xxxx is the name of the xlsx
count = 1
For X = 2 To Ws2.Range("A" & Rows.count).End(xlUp).Row
For Y = 1 To Ws1.Range("A" & Rows.count).End(xlUp).Row
count = count + 1
Ws.Cells(count, 1).Value = Ws2.Cells(X, 1).Value
Ws.Cells(count, 2).Value = Ws1.Cells(Y, 2).Value
Ws.Cells(count, 3).Value = Ws1.Cells(Y, 1).Value
Next Y
Next X
Application.ScreenUpdating = True
MsgBox ("Spreadsheet updated")
End Sub