Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a worksheet (Data):
A B C IMS Line Accurate y Banctec y y Advisor y Excel y There are 12 rows. Column A is a list of services, IMS and LIne are components used by those services. In this example Accurate uses IMS so there is a y in cell B2. I have a form with 2 listboxes, one (lbcomp) is autopopulated using cells B1:C1. the other (lbsource) is autopopulated using cells A2:A12. When a user selects a component from lbcomp I want all of the services with a y against them to be highlighted, so if someone chooses IMS I want Accurate, Banctec and Excel to be selected in lbsource. So far I have written code which makes a msgbox report whethere the service is used or not (i haven't quite figured out the selection part yet). My code works for the first two rows but when it hits the third time it fails and I get a Runtime error 13, type mismatch error. I am new to VBA and tend to clone what I can from this group and others so this has me stumped. The offending code follows: Private Sub Lbcomp_Click() Dim iloop As Integer Dim res As String For iloop = 0 To lbsource.ListCount - 1 res = Application.Index(Worksheets("Data").Range("b2:c12 "), _ Application.Match(lbcomp.Text, _ Worksheets("Data").Range("b1:c1"), 0), _ Application.Match(lbsource.List(iloop), _ Worksheets("Data").Range("a2:a12"), 0)) If res = "y" Then MsgBox lbsource.List(iloop) & " uses this component." Else: If res = "" Then MsgBox lbsource.List(iloop) & " doesn 't use this component." Else If IsEmpty(res) Then MsgBox "res is empty!" End If End If End If Next iloop End Sub Any help would be greatly appreciated! Thanks very much |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
autofilter problem | Excel Worksheet Functions | |||
Conversion | Excel Worksheet Functions | |||
Mouse continues to select after clicking on a cell in excel. | Excel Discussion (Misc queries) | |||
Row Autofit problem Excel 2003 | Excel Discussion (Misc queries) | |||
Index Match Problem | Excel Worksheet Functions |