Hi,
I am trying to create a UDF for to shorten my formula used in my workbook.
The function does not work and returns a #Value error.
I am new to structured reference, but my research tells me that I can pass a formula as a string to Evaluate in VBA.
Please tell me what is going wrong?
I am trying to create a UDF for to shorten my formula used in my workbook.
The function does not work and returns a #Value error.
I am new to structured reference, but my research tells me that I can pass a formula as a string to Evaluate in VBA.
Please tell me what is going wrong?
VBA Code:
Function HoriVLUp(headerName As String) As Variant
Dim str As String
str = "VLOOKUP([@[Hori.]],HorizontalProfile[#All],MATCH(HorizontalProfile[[#Headers],[" & _
headerName & _
"]],HorizontalProfile[#Headers],0),FALSE)"
HoriVLUp = Application.Evaluate(str)
End Function