+ Reply to Thread
Results 1 to 5 of 5

listbox double click not allowing selection of upto last 4 items

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    430

    listbox double click not allowing selection of upto last 4 items

    Good Morning All

    I have a listbox that shows variable selected information in 9 columns.

    The list can be anywhere from 1 to hundred's of lines...

    Using the macro below when the user double clicks one of the lines then the information is moved to 9 textboxes.....

    The problem I'm having is:.... it will not allow the user to select any of the last 4 lines in the listbox.....

    Taking it line by line.. From Rec1 to Rec 5 everything is OK... when Rec 6 is added it won't allow the last line to be selected.. Rec 7 last 2 lines,, Rec 8 last 3 line and Rec 9 last 4 lines....

    If the list only has 4 or less lines then it won't allow any to be selected

    Appreciate any help

    Many thanks

    Jim

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JamesT1; 05-11-2022 at 06:05 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: listbox double click not allowing selection of upto last 4 items

    I can not replicate the problem you describe. Can you book example file.

    Any reason why the last 8 rows of the listbox are excluded?

    Also you have a Exit for in the loop, so only the first selected row is displayed. So do you really need to allow the user to select multiple rows?
    If not make the listbox single select and you can use the ListIndex property, rather than looping.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    430

    Re: listbox double click not allowing selection of upto last 4 items

    Hi Andy

    Many thanks for your reply....

    I didn't know the last 8 rows of the listbox were excluded,, could that explain the issues I'm having..

    I have attached a workbook with the Userform..

    The idea is the user will open the form and type in the surname of the person that updating the records for... the list could be just 1 line or multiple lines if the user has more than 1 record... or more staff with the same surname.. etc

    The user should then double click on the line for the required information to update the text/combo boxes this would then allow that record to be updated

    Many thanks

    jim

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: listbox double click not allowing selection of upto last 4 items

    Revise the resultsList named range so it does not have empty rows

    =OFFSET(Data!$Q$8,0,0,COUNTA(Data!$Q:$Q)-4,9)

    The change to the code would be
    Please Login or Register  to view this content.
    The property ListCount tells you how many rows of data are in the listbox. As the List is zero based you need to subtract 1.
    You are currently subtracting 9, probably confusing that with the number of columns.

    Other than that all the textboxes appear to be updating correctly when you double click a row in the listbox

  5. #5
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    430

    Re: listbox double click not allowing selection of upto last 4 items

    Andy

    you are right, I was thinking the listCount was the same as the number of Columns

    Now works exactly as I wanted it

    many thanks for your help

    Jim

+ 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. Excel Double Click/Enter Listbox
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2017, 11:38 PM
  2. [SOLVED] Double-click a listbox inside a group
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2015, 08:23 AM
  3. [SOLVED] Move rows from one listbox to another by double click
    By Littlefarmer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2015, 10:39 AM
  4. [SOLVED] Double Click Listbox question
    By frostii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2015, 09:15 PM
  5. [SOLVED] ListBox Double Click () selection from another worksheet and populate data in text box
    By imzhakmaya in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2014, 03:49 AM
  6. Multi select Listbox Items selection based on other Listbox item selection.
    By srinivassathi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2011, 05:53 AM
  7. [SOLVED] Need selected item from listbox after double click
    By peterfarge@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 11:20 AM

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