CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2001
    Posts
    17

    reading excel row

    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


  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: reading excel row

    Use a Do...While Loop instead of the for loop.


  3. #3
    Join Date
    Apr 2001
    Posts
    17

    Re: reading excel row

    did a little rework but works great. must have gotten into a thinking rut not to think of it myself.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured