• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Listbox with duplicates only.

haai

New Member
I Have 2 columns (A and B)
Column A = the ID (unique) number, colum B has duplicate values .
I want to populate a userform listbox with the duplicates only.
The values that only appear once in column B should NOT be in de Listbox.
LIke this:
Col A Col B
1 Cheese
15 Cheese
8 Bread
29 Bread
..........
 

Marc L

Excel Ninja
No ListBox in your attachment … :rolleyes:
Anyway you can use a helper column with a COUNTIF formula for example …​
 

Marc L

Excel Ninja
Belleke,​
according to this link, to Excel basics like any beginner operating manually and to the Macro Recorder​
as a VBA beginner starter to paste to the UserForm code module :​
Code:
Private Sub UserForm_Initialize()
    With Blad1.[A1].CurrentRegion
              .Range("K2").Formula = "=COUNTIF(" & .Columns(2).Address & ",B2)>1"
              .AdvancedFilter xlFilterCopy, .Range("K1:K2"), .Range("M1:N1")
         With .Range("M1").CurrentRegion.Rows
           If .Count > 1 Then ListBox1.List = .Item("2:" & .Count).Value2
         End With
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Top