Hello - I have code (below) that reads through a set of .xlsm files in a folder and captures the date/time stamp and a count. The code works fine, except for two items:

1) There is a '#_ROW_DATA_END' record at the end of each file that gets written to my output worksheet that I would like to prevent. I've experimented with some 'If' statements, but I keep getting a 'Invalid or unqualified reference' error (I've stripped out those attempts in the code below).

2) Also, the current code continues to append records to 'Sheet2' when the code is running repetitively:

Please Login or Register  to view this content.
What do I need to add here to prevent the writing out of any row that contains the string ''#_ROW_DATA_END', but still captures the other records in the file? And what do I need to properly clear out any existing records before the next execution of the code which will write out the current records?

Thank you!