Forum Discussion

asantos2021's avatar
asantos2021
Copper Contributor
Nov 25, 2021
Solved

Why is this VBA code populating only the first occurrence found in the range?

Hello, The idea is to get the selected value, which is a date, and look for occurrences in a range matching that date and then load them into a listbox.   Here's what I've got so far, but: 01 - I...
  • HansVogelaar's avatar
    HansVogelaar
    Nov 25, 2021

    asantos2021 

    1) Change

    myList(2, n) = r.Offset(, -1).Value

    to

    myList(2, n) = Format(r.Offset(, -1).Value, "hh:mm")

    2) There are no duplicate dates in PartsData column C (please note that C5 is in 2020 and C7 is in 2021).

    If there are duplicate dates, the list box will display all of them.

Resources