check 3 columns in a listbox and get a count of occurences for each column
Posted on 2013-11-18
excel 2010 vba
What I have :
Listbox that is filled via an array.
listbox has 23 columns
A variable "str"
I need to use the variable/value from a combobox
(The code below is finding the "Like" value in Column 5 if it finds it.
It removes it from the item from the listbox...
I'am showing this as reference.)
What I need:
I need to get a count of "Like" occurences in Column 5, 13, 19 in the listbox
and return for all three columns the count
cn1 = 2
cn2 = 5
cn3 = 3
If UserForm2.ComboBox1.Value <> "" Then
str = UserForm2.ComboBox1.Value
For ri = .ListCount - 1 To 0 Step -1
If Not (LCase(.List(ri, 5)) Like "*" & LCase(str) & "*") Then 'Or Not (LCase(.List(ri, 19)) Like "*" & LCase(str) & "*") Then