Solved

count items in listbox with specific string in column 2

Posted on 2013-11-05
3
267 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
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
How about a dummy sample for testing?
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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 ]
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now