title: VBA Code for Excel VBA Lookup based on multiple inputs(partial)
body: <p>My Excel Sheet format is similar to this</p>
  
  <pre><code>Name code1  Name Code2  Name       Number    Input1   Input2   
  AB           XY        GSABPEXY1    110      BA       BC
  BC           BA        GSBCPEBA1    120
  CD           CA        GSCDPECA1    13
  DC           DA        GSDCPEDA3    140
  BC           BA        GSBCPEBA3    15
  </code></pre>
  
  <p>Question:</p>
  
  <ol>
  <li>I want to obtain the values in the Name column by matching the inputs as in Input1 AND Input2. </li>
  <li>I need these matched values to be pasted in another sheet's predefined specific row and columns cells</li>
  <li>Using excel function countifs i am counting the number of rows having same  repeating values in the Column A (name code1) and B (name code2) e.g. in above BC and BA which gives a count of 2.</li>
  <li>I would like to use this value (mentioned in #3) for the loop iteration</li>
  </ol>
  
  <p>I got this code which looks very close but it lacks two things ABC is predefined in INSTR function and it doesn't have the AND operator - i do not know how to do it. I am very new to VBA so please pardon me if I am missing something simple and/or providing less info.</p>
  
  <p>Code:</p>
  
  <pre><code>Sub Hostname()
      Dim K As Long, r As Range, v As Variant
      K = 1
      Dim w1 As Worksheet, w2 As Worksheet
      Set w1 = Sheets("Sheet2")
      Set w2 = Sheets("Sheet3")
      w1.Activate
      For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
          v = r.Value
          If InStr(v, "ABC") &gt; 0 Then
              r.Copy w2.Cells(K, 1)
              K = K + 1
          End If
      Next r
  End Sub
  </code></pre>