title: Get vlookup and check whether the value is available or not?
body: <p>I'm new trying to write vba code using vb. I wrote this code using vba tutorial. Now I have tried to write sample code for output as followed:</p>
  
  <p>Also I am trying to shortcut key for to create macro in vba</p>
  
  <pre><code>Sheet 1
  Column B
  123456
  
  Column E
  20/3/2000
  
  
  Sheet2
  Column A
  123456
  
  Column D
  25/3/2000
  </code></pre>
  
  <p>I am trying to check whether the date is available in sheet2 for "123456" or if it is not available in sheet 2. I have to create output for "123456".
  Output should be column like</p>
  
  <pre><code>ColumnA
  123456
  ColumnB
  20/3/2000
  ColumnC
  2
  </code></pre>
  
  <p>My code is :</p>
  
  <pre><code>Sub Button1_Click()
  Dim ColNum As Integer
  Dim Line As String
  Dim LineValues() As Variant
  Dim OutputFileNum As Integer
  Dim PathName As String
  Dim RowNum As Integer
  Dim SheetValues() As Variant
  Dim rngNums As Range
  Dim cmpny As Range
  Dim v As Long
  Dim ws As Worksheet
  Dim result As Variant
  Dim c As Range, nm As Range
  
  PathName = Application.ActiveWorkbook.Path
  OutputFileNum = FreeFile
  
  Open PathName &amp; "\test.csv" For Output Lock Write As #OutputFileNum
  
  Print #OutputFileNum, "test1" &amp; "," &amp; "test2 (dd/MM/yyyy)" &amp; "," &amp; "test3"
  
  End Sub
  </code></pre>