I have created a following function, but this is not giving me the desired
result, i want to get customer name from customer master file, with input of
customer code.
please help me out.
Public Function CustomerName(CustomerCode As string) as string
Workbooks.Open Filename:= _
"C:\CUSTOMER\CUSTOMERLIST.XLS"
Worksheets("LIST").Activate
Worksheets("LIST").Range("A1").Select
I = 0
For I = 0 To 200
If Selection.Offset(I, 0).Value = CUSTOMERCODE Then
CUSTOMERNAME = Selection.Offset(I, 1).Value
End If
Next
ActiveWindow.Close
End function