+ Reply to Thread
Results 1 to 2 of 2

Listbox1 If Statement

  1. #1
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Listbox1 If Statement

    I am struggling to re-list the contents of a userform listbox once its filled, does anybody have any experience using them?
    The code runs when my userform activates and lists all the files within a specified folder & a wildcard lookup which works fine.

    fName is the folder location on my hard drive in sheet1.
    lookup is the part of a filename of text files I am trying to search through, matches list inside ListBox1 matching the word "Online" or "Offline"

    Please Login or Register  to view this content.
    If I repeat the above code to another userform button, I get a runtime error 9.
    I am trying to re-list the contents of ListBox1 array, maybe the code can not be used this way.
    Any help is much appreciated.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Listbox1 If Statement

    First, it is not necessary to store the filenames in an array then copy them to your listbox. Are you using that array anywhere else? You can populate the listbox directly. However, that is not causing your problem.

    It would help to know which line of code is shown when you get the error. Regardless the problem is likely that you are not clearing out the listbox before repopulating it. Try this version.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Take Focus away from Listbox1
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2015, 08:08 PM
  2. Select listbox1 item and Press EDIT button to make changes in listbox1 values
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2014, 08:36 AM
  3. [SOLVED] Listbox1 refresh
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-05-2014, 08:18 AM
  4. [SOLVED] clear listbox1
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2012, 10:01 AM
  5. [SOLVED] UserForm:Resume to ListBox1
    By damorrison in forum Excel General
    Replies: 1
    Last Post: 08-20-2006, 11:25 AM
  6. [SOLVED] Help with: ListBox1.AddItem (ws.Name)
    By NightProbe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2005, 03:06 PM
  7. [SOLVED] Listbox1 to Listbox2?
    By Moretakitty in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-20-2005, 07:06 PM

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