+ Reply to Thread
Results 1 to 3 of 3

Populating a list box with items from cell

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Populating a list box with items from cell

    Hi, just joined today, so really please to be here.

    Hoping someone can help with my question. I have nearly got it right, but not quite.

    I have a userform with1 listbox.

    when the form loads, I have the vba macro look for for all .jpg files in a directory given a certain reference from a cell on the worksheet, for example, 12345

    This works fine.

    Please Login or Register  to view this content.
    The above is not a problem as long as there is more than 1 file to find. If it doesn't find any files then it's ok, if it finds more than 1 file it's ok, but if there is only 1 file to find it hangs then crashes.

    Any ideas please?
    Last edited by HikariHitachi; 03-14-2013 at 01:54 PM. Reason: typo and error in post

  2. #2
    Registered User
    Join Date
    08-31-2012
    Location
    Delaware, USA
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Populating a list box with items from cell

    Looks like the found = found +1 keeps the next step from finding a file when there is only 1 file.

    Terry

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Populating a list box with items from cell

    I don't see why that code would fail when there is only one file.

    It doesn't when I run the code on a folder with only one file.

    Where does the code crash?
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1