[Tutor] Traversing Excel Columns

Etrade Griffiths etrade.griffiths at dsl.pipex.com
Tue Sep 12 13:25:50 CEST 2006


Chris

are you looking for something like this?

xlSht=xlApp.Worksheets("Sheet1")

irow=1
XL_row_has_data=1

while XL_row_has_data:
     xlRng=xlSht.Range(xlSht.Cells(irow,1),xlSht.Cells(irow,256))
     ncell=xlApp.WorksheetFunction.CountA(xlRng)

     if ncell ==0:
         # Cells in current row are all empty
         XL_row_has_data=0
     else:
         # Look in next row
         irow=irow+1

print "first row with empty cells is row "+str(irow)

HTH

Alun Griffiths




More information about the Tutor mailing list