Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

count items in listbox with specific string in column 2

Posted on 2013-11-05
3
Medium Priority
?
308 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 53

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Industry Leaders: 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 describes a serious pitfall that can happen when deleting shapes using VBA.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

618 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