Hi, I am trying to make a macro that lookup one value from the active sheet and returns the value from the lookuptable
all I get is #N/A
can anyone help ?
the code looks like this :
Sub midtest()
Dim LResult As String
Dim Result As Variant
Dim Dependents As Range
Set Dependents = Workbooks(“Varermedeankode.xlsx”).Worksheets(“Sheet1”).Range(“Intern_tekst”)
LResult = Val(Mid(Range(“A14”).Value, 8, 13))
‘LResult = Mid(Selection.Formula.Value, 8, 13)
‘Result = Application.VLookup(LResult, Dependents.Value, 2, False)
‘Result = Application.WorksheetFunction.VLookup(LResult, Dependents.Value, 2, False)
Result = Application.Evaluate(Application.VLookup(LResult, Dependents.Value, 2, False))
Range(“c14”) = Result
End Sub
kind regards
Peter