title: Excel macro that returns all values for lookup for a range
body: <p>I know that heading may seem Ultra confusing but it's the best way I could do.</p>
  
  <p>To give further explaination I have a single work book and two sheets:</p>
  
  <ul>
  <li><p>Sheet A has people's names in row 1 (A1, B1, C1, etc). The number of names changes, sometimes more sometimes less.</p></li>
  <li><p>Sheet B has the list of people's names in Column A and a value in Column B. For example:</p>
  
  <pre><code>A       B
  John    22
  John    13
  Sam     90
  </code></pre></li>
  </ul>
  
  <p>What I need is a macro that looks at the value in the first row in each column in Sheet A and returns pastes all the matching values from the list in Sheet B to the second row in Sheet A.</p>
  
  <p>It would look something like:</p>
  
  <ul>
  <li><p>Sheet A: </p>
  
  <pre><code>A        B
  John     Sam
  22       90
  13
  </code></pre></li>
  </ul>
  
  <p>I haven't had the time to test anything up but I was thinking that I might be able to paste a formula in B1:B[X] that looks up the number of times the names occurs in the list and finds its starting position and use that to copy and paste the corresponding range from column B.</p>
  
  <p>I'm not a macro pro but that's the direction my mind is going right now. If anyone could make sense of that dry explanation and could help that would be amazing!  </p>