I am working on a project to create a simple VLOOKUP.
I have created the macro but it not works well, but now I am looking for some advise on how to modify the code.
I have a list of products(english and other names) with account codes.
I want to use VLOOKUP to find the english or other name when I chose from combobox.
I have created the macro but it not works well, but now I am looking for some advise on how to modify the code.
I have a list of products(english and other names) with account codes.
I want to use VLOOKUP to find the english or other name when I chose from combobox.
Code:
Sub DropDown1_Change()If [L2] = 1 Then
Dim Alan As Range
For Each Alan In Sheets(1).Range("a1:a5")
On Error GoTo Hata
Alan.Offset(0, 1) = WorksheetFunction.VLookup(Alan, Sheets(1).Range("F7:H11"), 2, False)
Hata: If Err Then MsgBox Alan.Address & "account not defined "
Next Alan
Else
For Each Alan In Sheets(1).Range("a1:a5")
On Error GoTo Hata
Alan.Offset(0, 1) = WorksheetFunction.VLookup(Alan, Sheets(1).Range("F7:H11"), 3, False)
Hata: If Err Then MsgBox Alan.Address & "account not defined "
Next Alan
End If
End Sub