I am trying to make some VBA that will add data to an existing CSV file, I have the below code but it overwrites the existing data instead of adding to it. I am guessing as it goes to the beginning of the file but am unsure how to force to add to the file.
Sub WriteCSV()
Dim iLastRow As Long
Dim iLastCol As Long
Dim FilePath As String
Dim Filename As String
Dim Fullpath As String
Fullpath = Worksheets("GUI").Range("f11")
iLastRow = Range("A" & Rows.Count).End(xlUp).Row
iLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Open Fullpath For Append As #1
For i = 1 To iLastRow
For j = 1 To iLastCol
If j <> iLastCol Then 'keep writing to same line
Write #1, Cells(i, j),
Else 'end the line
Write #1, Cells(i, j)
End If
Next j
Next i
Close #1
End Sub