Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have created a userform wherein there is a combobox which refers the masterlist contents columns like: Col. A = Old Item Code Col. B = New Item Code & Col. C is Description. Combobox lookups the list for Col. A, i.e. Old Item Code. Upto here it is working fine. The problem is, some time user doesn't know the Old item code, he only knows the new item code. Now in such cases, the user will enter the new item code in combobox & then the combobox should lookup the value from Col. B instead of Col. A The combobox should refer either Col. A List if does not found then look the value in Col. B and return the result. Hope I explained it correctly. Is it possible? Looking forward! ================================================= Here is some code: For Each cPart In ws.Range("PartIDList") With Me.cboPart .AddItem cPart.Value .List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value End With ================================================== === As soon as the user enter the value in combo box, it returns Private Sub cboPart_Change() Dim LookupRange As Range Dim res As Variant Set LookupRange = Worksheets("LookupLists").Range("A:I") If cboPart < "" Then res = Application.VLookup(Me.cboPart.Value, LookupRange, 3, 0) If IsError(res) Then 'look as a number: On Error Resume Next res _ = Application.VLookup(CDbl(Me.cboPart.Value), LookupRange, 3, 0) End If If IsError(res) Then MsgBox "An Error occurred ! Plz. check the Part Code!" Else Me.LblDesc = res End If End If End Sub ================================================== === Master Sheet Looks Like: OldImCode NewImCode ImDesc. ATM0028 TET018A WOOD STOCK FR LH OLD ATM0030 TET020A WOOD STOCK FR RH OLD ATM0031 TET021A WOOD STOCK RR LH OLD ATM0032 TET022A WOOD STOCK RR RH OLD AND SO ON....... -- Thanks, Vikram P. Dhemare |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
match multiple criteria ina range from multiple criteria multiplet | Excel Worksheet Functions | |||
Combobox list - only with rows that fit the criteria | Excel Discussion (Misc queries) | |||
Excel Combobox with additional selection criteria | Excel Programming | |||
Counting Cells with multiple criteria.One criteria supporting wild | Excel Worksheet Functions | |||
Counting Cells with multiple criteria.One criteria supporting wild | Excel Worksheet Functions |