LOCAL lcXLSFile, lcRange, llfound, lncount, oExcel, lcvalue, lnlength, lcdir lcRange = "a1:E1000" && just guessing range here! llfound = .F. lncount = 0 lcvalue = '' lnlength = 0 lcdir = '' *--More stuff *--Loop through all xls files in the directory FOR ifile = 1 TO ALEN(lafiles,1) m.fieldname = '' m.corder = '' m.cver = '' m.cform = '' IF TYPE('lafiles(ifile,1)')="C" .AND. !EMPTY(lafiles(ifile,1)) lcXLSFile=lcdir+lafiles(ifile,1) ELSE LOOP ENDIF oExcel = CREATEOBJECT("excel.application") WITH oExcel .Workbooks.OPEN(lcXLSFile) WITH .ActiveWorkbook.ActiveSheet.RANGE(lcRange) FOR ix = 1 TO .ROWS.COUNT *--Here is where I check to see if the ix,5 is empty or not. If I pass *--three empty rows in sequence then I exit the loop because I am probably *--at the end of the spreadsheet. *--I would like to specify the correct range above in the line: *--WITH .ActiveWorkbook.ActiveSheet.RANGE(lcRange) <== ? correct range *--More Stuff