So I am trying to write some code in a workbook that will open a file in a certain filepath using VBA, find data that exists in a row with a certain row number and then overwrite those rows given that row number. I am aware of the "Open File For Input/Output/Append" functions but "Input" only reads, "Output" overwrites all the data in my file and "Append" only adds data to the end of the file. I have been stuck for a while now and could really use some help. Here is my current code segment:
Open Filepath For Output As #2
ExternalRowCount = 0 ' Row number where I want to start writing data.
ArrayRef = 0 ' Array Index for data
Do Until EOF(1)
ExternalRowCount = ExternalRowCount + 1
If ExternalRowCount >= Found And ExternalRowCount < (Found + 100) Then ' looping through rows to get to my desired location ("Found" is my desired row number)
CellData = arr1(ArrayRef)
CellDataTwo = arr2(ArrayRef)
Write #2, CellData, CellDataTwo
ArrayRef = ArrayRef + 1
End If
Loop
Close #2
Any help would be greatly appreciated! Thank you
EOF(1)? Where do you read data from a file?