+ Reply to Thread
Results 1 to 4 of 4

CheckBox x ListBox - Loop Conflict

  1. #1
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    CheckBox x ListBox - Loop Conflict

    Hello my friends... I got one issue with my Form's CheckBox and ListBox.

    When I click on the CheckBox, it unmarks/marks every item in ListBox...

    Works fine:

    Please Login or Register  to view this content.
    When I click on ListBox itens, if my click marks ALL itens, it marks the CheckBox

    Please Login or Register  to view this content.
    The problem is: When I try to put both codes together, they conflict

    What happens:
    * Cannot mark the Checkbox by clicking, because it activates the listbox event, and unmark the checkbox, because it runs the loop
    * When I mark by clicking all itens in listbox, checkbox gets marked, but when, after, I unmark one item, the checkbox gets unmarked, making the code of checkbox unmark ALL listbox itens

    Last edited by Gatti; 02-05-2016 at 05:03 PM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: CheckBox x ListBox - Loop Conflict

    Hi Gatti,

    This should help you turn your sad face into . What you need is a 'Disable Events' for your UserForm. Excel does not provide one, so you have to bring your own to the party.

    Try something like the following code in your UserForm code module. I was unable to test the code, because I did not see a sample file.
    Please Login or Register  to view this content.
    I hope this helps.

    Lewis

  3. #3
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: CheckBox x ListBox - Loop Conflict

    Hello Lewis

    Thanks in advance!

    Just managed to fix my problem using the MouseUp event

    I'll just keep the answer here... if someone has the same problem as I

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Thread marked as [SOLVED] and added reputation cause your good solution!

    Thanks again.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: CheckBox x ListBox - Loop Conflict

    Hi,

    Thanks for the rep points. I come across situations like yours all the time and usually solve it with a Pseudo-UserForm-Event-Disable Software Flag like I posted above. I occasionally use other workarounds, but I never thought of using a Mouse Event. Excellent idea.

    Lewis

+ 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] Loop find all matches of listbox items, display results in another listbox
    By banaanas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2015, 02:56 AM
  2. Listbox+checkbox = show info
    By mastaliyev in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2014, 02:52 AM
  3. Updating a set of checkbox once a listbox changes
    By jsneak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2013, 07:03 PM
  4. Having problems populating a multicolumn listbox changing Listbox column with a loop.
    By Aristizabal95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2013, 12:41 PM
  5. Add or remove items with a checkbox into a listbox
    By Nuno Neves in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-30-2009, 01:19 PM
  6. Checkbox or listbox?
    By ahartman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2008, 12:10 PM
  7. VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox)
    By modjoe23 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2005, 09:35 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