Solved

count items in listbox with specific string in column 2

Posted on 2013-11-05
3
300 Views
Last Modified: 2013-11-06
excel 2010 vba
on a userform

I need to update a label with the number of items in a listbox that have a specific value.
in column 2


label12

looking for this term     "EEMRC"

frmR.ListBox1.List(2) = "EEMRC"
??

Thanks
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39626608
How about a dummy sample for testing?
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39626633
Hi,

pls try
Private Sub Macro4()
Dim intListBox As Integer
Dim intIdx As Integer
For intListBox = 0 To frmR.ListBox1.ListCount - 1
    If frmR.ListBox1.List(intListBox, 2) = "EEMRC" Then
        intIdx = intIdx + 1
    End If
Next
'frmR.Label1 = intIdx
End Sub

Open in new window

Regards
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39626719
PS. fordraiders: I added a revised version of our ongoing workbook development to your existing thread yesterday...

[ http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28264352.html#a39623969 ]

(As you have listed a new question [here], but not responded to my latest comment, I wondered if you had noticed the addition to the previous question)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question