When I’m outputting text or data, I tend to output it into text files. They’re simple and clean. But people often want Excel files. Yeah, I don’t understand it either.
I sat down today and had a look at writing extra data to an Excel file, and found that adding data to the last line isn’t always simple.
set objExcel = CreateObject(“Excel.Application”)
Set objWorkbook = objExcel.Workbooks.Open(FILENAME)
LastRow = objExcel.ActiveSheet.UsedRange.Rows.Count
objExcel.Cells(LastRow + 1, 1).Value = “Test value”
This function loads an Excel file, finds the first blank row and writes to it, then saves and closes the file. And does so, all invisibly to the user.