Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    populate comun with unique item (2000 sr-1)

    i ahve arranged this function to populate listbox without dupes and use to populate instead listbox a column bu not work have other wy or correct it, tks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: populate comun with unique item (2000 sr-1)

    The original code was used to populate a list box when a userform was loaded. Why would you want to populate a worksheet column when the userform is loaded?

    If you don't want to use a listbox, the name TheListBox is confusing.

    And you can't set a range to an array. Try this version of PopulateCOLUMN:

    Function PopulateCOLUMN(ByRef AnotherRange As Range, ByVal TheRange As Range)
    Dim TempArr(), I As Long, Cnt As Long, CLL As Range
    Cnt = 0
    ReDim TempArr(0)
    Set TheRange = Intersect(TheRange, TheRange.Parent.UsedRange)
    If TheRange Is Nothing Then Exit Function
    For Each CLL In TheRange.Cells
    If Trim(CLL.Value) <> vbNullString Then
    For I = 0 To Cnt - 1
    If TempArr(I) = CLL.Value Then Exit For
    Next
    If I = Cnt Then
    ReDim Preserve TempArr(Cnt)
    TempArr(Cnt) = CLL.Value
    Cnt = Cnt + 1
    End If
    End If
    Next
    Call ORDER_ITEMS(TempArr)
    If Cnt > 0 Then
    For I = 0 To UBound(TempArr)
    AnotherRange.Offset(I, 0) = TempArr(I)
    Next I
    End If
    End Function

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: populate comun with unique item (2000 sr-1)

    no dubt.... for me you have "WIZARD LEVEL" in this forum.
    Tks.
    Note: when you post i can learn a lot about VBA... other user when, and if post, a solution not insert note for exaplin code and this is not productive to learn...

    Tks for patience and for note!

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: populate comun with unique item (2000 sr-1)

    ahhhhhhhh.....
    But if i want to recopy unique value instead to vertical in horizontal started always from A3...

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: populate comun with unique item (2000 sr-1)

    Change

    AnotherRange.Offset(I, 0) = TempArr(I)

    to

    AnotherRange.Offset(0, I) = TempArr(I)

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: populate comun with unique item (2000 sr-1)

    I'M STUPID!!!!
    Tks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •