title: Vlookup in filtered Range with Varaible Lookup Value, Variable Lookup Range VBA
body: <p>I am trying to apply Vlookup on a filtered range with Variable Lookup Value(Changing according to the row number) and Variable Lookup Range(From a user browsed workbook). But, the formula bar after running the code shows the formula as :-</p>
  <pre><code>=IFERROR(VLOOKUP(@Sri Lanka15-@a_One-@Time Base Rent,'[C_Rent Report_25082020.xlsx]Sheet 1'!$J$1:$N$968,4,0),&quot; &quot;)
  </code></pre>
  <p>I am not sure where these &quot;@&quot; signs are coming from. The lookup value for this particular row is :-Sri Lanka15-a_One-Time Base Rent.</p>
  <p>Below is the code:-</p>
  <pre><code>    Dim LR As Long   ' Defined as Last row in source file
      Dim nlr As Long   'Defined as Last row in Macro Workbook where vlookup is applied
      Dim Filename As String
      Filename = Application.GetOpenFilename(FileFilter:=&quot;All Files(*.xls; *.xlsx; *.csv),*xls,*.xlsx, *csv&quot;, Title:=&quot;Select File To Be Opened&quot;)
      Workbooks.Open Filename:=Filename
      sourcefile = Dir(Filename)
      With ActiveSheet
         Range(&quot;A1:AQ&quot; &amp; nlr).AutoFilter Field:=25, Criteria1:=&quot;One-Time Base Rent&quot;
         For Each cell In Range(&quot;AA2:AA&quot; &amp; nlr).SpecialCells(xlCellTypeVisible)
              lookupvalue = Cells(cell.Row, &quot;Z&quot;).Value
              cell.Formula = &quot;=IFERROR(VLOOKUP(&quot; &amp; lookupvalue &amp; &quot;,'[&quot; &amp; sourcefile &amp; &quot;]Sheet 1'!$J$1:$N$&quot; &amp; LR &amp; &quot;,4,0),&quot;&quot; &quot;&quot;)&quot;    ' The problem seems to be here in lookup value as rest are appearing as fine in formula
         Next
               
      End With
  </code></pre>
  <p>Since i need to apply subsequent filters after this. i would like to keep the lookup value as variable.</p>
  <p>I have tried WorksheetFunction.Vlookup too, but i am not sure how to define the range from a file chosen by user in worksheetfunction</p>
  <p>Any help is highly appreciated !!
  Thanks</p>