+ Reply to Thread
Results 1 to 6 of 6

Listbox displaying multiple dates that are the same

  1. #1
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Listbox displaying multiple dates that are the same

    I know the title is a little confusing, but i couldn't think of a better way to put it. I have a listbox connected to a combobox. the combobox acts like a filter, allowing the user to change from multiple different selections, which appear in the listbox.

    the problem i am having is when two of the items that appear in the listbox are the same, then the data displayed to the right will only show the top most row. i have attached the example.

    On this example, the userform is called frmEditData. if you filter claim, you'll notice that since each number appearing in the listbox is different, it will display the corresponding data in the right. If you use the date of loss search parameter, all three are the same, so it will only show the top row.

    Thanks so much for all of your help in advance, i greatly GREATLY appreciate all of your time with helping me.
    Attached Files Attached Files
    Last edited by brouhaha501; 02-24-2010 at 11:46 AM.

  2. #2
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox displaying multiple dates that are the same

    I apologize that the original posting was not very well put together, let me try to re-phrase. Listbox1 automatically populates from a rowsource.When a value is clicked in the listbox, it will then populate different fields in the userform from that row. If two or more of the values in the listbox are the same, then only the highest row will be populated in the rest of the userform.

    If someone could help, it would be VERY greatly appreciated. thanks again for your time.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Listbox displaying multiple dates that are the same

    Don't populate Listbox1 from a rowsource. Make it a 2 column listbox and populate it with the dates from the worksheet and the row numbers they are on. You can then populate the rest of the form using the row number directly rather than a VLOOKUP or Find or whatever.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox displaying multiple dates that are the same

    I was mistaken in saying that they are populated by rowsource, The populated data in the listbox is from different ranges, selected using a combobox:
    Please Login or Register  to view this content.
    In regards to adding another column to the listbox, I have changed the ColumnCount to 2, but because the information in the listbox changes, i'm not quite sure where to program the second listbox. I have never input multiple columns into a listbox before, so I have tried changing the above code to say the following:
    Please Login or Register  to view this content.
    Then, added another section of cases, which read
    Please Login or Register  to view this content.
    but received an error "Run-Time error '1004': Method 'Range' of object'_Workshet' failed." Please forgive my incompetence with this, and I feel really embarrassed because it seems that the column count should be an easy fix, i just have never done it before.

    Romper, thanks again for all of your help. I really appreciate it.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Listbox displaying multiple dates that are the same

    Thinking about it again, it's actually easier than that since you are loading every row into the listbox. That means that you just need to add 2 to the Listindex of the listbox (since it starts at 0 for the first item in the list and your data starts at row 2). So your Listbox click event becomes:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-27-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Listbox displaying multiple dates that are the same

    Works perfect!! Thanks so much for your help!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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