title: I'm new in VBA coding, I run this code and get compile error right before (vlookup) word
body: <p>Please help me analyze this code and make correction cause I am stuck.</p>
  <pre><code>Dim sh As Worksheet
  Set sh = ThisWorkbook.Sheets(&quot;Sale_Purchase&quot;)
  Dim lr As Long
  lr = Application.WorksheetFunction.CountA(sh.Range(&quot;A:A&quot;)) 
  sh.Range(&quot;A&quot; &amp; lr + 1).Value = lr
  sh.Range(&quot;B&quot; &amp; lr + 1).Value = Me.cmb_Product.Value
  sh.Range(&quot;C&quot; &amp; lr + 1).Value = Me.cmb_Type.Value
  sh.Range(&quot;D&quot; &amp; lr + 1).Value = Me.txt_Qty.Value
  sh.Range(&quot;E&quot; &amp; lr + 1).Value = Me.txt_Rate.Value
  sh.Range(&quot;F&quot; &amp; lr + 1).Value = Me.txt_Rate.Value * Me.txt_Qty.Value
  If Me.cmb_Type.Value = &quot;Purchase&quot; Then
     sh.Range(&quot;G&quot; &amp; lr + 1).Value = &quot;NA&quot;
  Else
     sh.Range(&quot;G&quot; &amp; lr + 1).Value = (Me.txt_Rate.Value * Me.txt_Qty.Value) -
     Application.WorksheetFunction.VLookup(Me.cmb_Product, _
     ThisWorkbook.Sheets(&quot;Product_Master&quot;).Range(&quot;B:D&quot;, 3, 0)) * Me.txt_Qty.Value
  End If
  </code></pre>