Reputation: 1
I'm having a problem with a vlookup function. First code shows that vlookup know what is "TempArg'17", but now I want to change it this text to string and write it inside vlookup, so I created a string temp.
Dim temp As String
Dim num As Int
num = 17
temp = "TempArg" + "'" + Cstr(num)
Here is the old code that works:
ActiveCell.FormulaR1C1 = _
"=VLOOKUP([@[" & Chr(10) & "Številka]],'TempArg''17'!C[-16]:C[-17],2,FALSE)"
And here is the code that I want to change and that doesn't work:
ActiveCell.FormulaR1C1 = _
"=VLOOKUP([@[" & Chr(10) & "Številka]],temp'!C[-16]:C[-17],2,FALSE)"
Thanks in advance.
Upvotes: 0
Views: 212
Reputation: 781
Try this
"=VLOOKUP([@[" & Chr(10) & "Številka]],'" & temp & "'!C[-16]:C[-17],2,FALSE)"
Upvotes: 2