I have been looking for quite a while for an answer to this and I am amazed it does not seem to be readily available. I have a large number of CSV files. Over 100,000 in fact the last line has "end of report" as the second column and does not have the same number of columns as the rest. If I set lastrow = to the numeric value of my last row the code works fine. Imports into the SQL table with no problem. Otherwise it errors out with an end of file error 5832 I think.
I am at the point of having to write a utility to process the CSV file but surely there is a better answer. Does anyone know how to just discard the last line? I have tried try-catch, error files and so on nothing seems to work. I would think in processing text files this would be a common requirement but so far that does not appear to be so.