Highlight visible items of ListBox based on a condition

  • Another possible solution would be to use a ListView control rather than a ListBox.


    Code can be written to have the rows in the ListView with different coloured font, so font could be red if column C is empty and green if not.


    The coding is not straight forward.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • You can synchronise 2 or more list boxes using the "frame" method I used in the file attached with Post #16.


    Each List Box needs to be in a separate frame with frame width reduced to hide the scroll bars, then the separate ScrollBar control is used to adjust the .ListIndex of all the List Boxes in their Frames.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • The initial request was


    Quote

    without "Clicking" in the ListBox


    This creates the constraint for Windows to detect Scrolling ...


    And ... in order to detect Scrolling ... you need to consider SubClassing ...


    which is not always very stable ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)



  • Hi Carim


    You're right, meaning I wanted the Labels colors to be updated without selecting from the ListBox!
    But the ListBox needs to be available, so that I can then select items that have no value and assign them a value.


    I'm trying to sync both ListBox ... it's not being easy ...


    I couldn't test the CPearson example, it's giving me a mistake.


    Thanks

  • I really cannot think of another way to achieve what you are doing.


    When I make UserForms I try to make them fairly dynamic. You could start by using a Table for the data, which would always reflect addition or removals of rows.


    Can you attach the real workbook, with sensitive data changed.


    Unfortunately I can't isolate this problem from the rest of the workbook.


    The best I can do is put this example and yet I will have to make many adjustments to move to the real workbook.


    Thank you so much for trying to help. I am sure that with all these options we will come up with a solution.

  • You seem to remain totally silent about many many constraints you want to stick to ...


    As a result ... suggestions to help you out ...end up being way off the mark ... !!!


    As long as you are not using more than 16'383 columns in your sheet ...


    you could dedicate one column to the IF formula suggested earlier ....


    which would be the first column of your ListBox ... and you could then forget all your labels altogether ...


    Boa continuação

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Quote

    But the ListBox needs to be available, so that I can then select items that have no value and assign them a value


    In that case why are you not adding just the rows of data that have no value in column C to the list box???


    You could then select each item in the list box and assign the missing value.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.


  • In that case why are you not adding just the rows of data that have no value in column C to the list box???


    You could then select each item in the list box and assign the missing value.


    Because in the real case, I may want to change the values of other items (those that already have values) and not just enter values in those that don't have values.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!