Solved

count items in listbox with specific string in column 2

Posted on 2013-11-05
3
302 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

Independent Software Vendors: 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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

696 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