leary
May 1st, 2001, 10:12 PM
when reading an excel row of unknown length how can i get the loop to stop when the cells are empty. I have limit set at 150 but list box shows empty after 119. I need to allow for larger sheets for expandibility but don't want to risk user selecting empty space in listbox. errors!
section of code below ...ole embedded
any suggestions appreciated
For intCol = 5 To 150 ' I want this to end of file
Debug.Print m_objSheet.Cells.Item(intRow, intCol)
lstDisplayDates.AddItem intCol & "." & " " & Trim(m_objSheet.Cells(intRow, intCol))
Next intCol
section of code below ...ole embedded
any suggestions appreciated
For intCol = 5 To 150 ' I want this to end of file
Debug.Print m_objSheet.Cells.Item(intRow, intCol)
lstDisplayDates.AddItem intCol & "." & " " & Trim(m_objSheet.Cells(intRow, intCol))
Next intCol