title: Excel VBA find in Table
body: <p>Im having a list of event participants in an Excel Sheet (Col A: Lastname; Col B: Firstname) and a Membership Table with the same plus info colums like birthdate and sex.</p>
  
  <p>No I want to loop through the event list and do some actions on the birthday/sex of the participants. I can express that in MySQL </p>
  
  <pre><code>SELECT birthdate, sex FROM members WHERE lastname = LASTNAME AND firstname = FIRSTNAME 
  </code></pre>
  
  <p>Where LASTNAME &amp; FIRSTNAME are pulled from the participants table. I can figure out how to create a Loop through the event table but I got trouble on how to pull the data from the Membership Table.</p>
  
  <p>Im just not used to Excel VBA so any help to start me off would be greatly appreciated</p>
  
  <p>So far I got following Loop:</p>
  
  <pre><code>Dim participantCount As Integer
  Dim sh As Worksheet
  Dim rw As Range
  
  Set sh = Sheets(INP_tblakt.Value)
  For Each rw In sh.Rows
  
      If sh.Cells(rw.Row, 1).Value = "" And sh.Cells(rw.Row, 2).Value = "" Then
          Exit For
      End If
  
     participantCount = participantCount + 1
  Next rw
  </code></pre>
  
  <p>EDIT: To Clearify</p>
  
  <p>I got the loop above in wich I want to insert a "function" wich looks up in another sheet the row where <code>A? = sh.Cells(rw.Row,1)</code> and <code>B? = sh.Cells(rw.Row,2)</code> So that I then can get the value from D? and E? to use it for further calculation.
  The VBA function Find does only support the matching of one Colum. I now found MATCH and IDEX but couldnt succesfully implement them.
  <em>(Hopefully this does help to understand the question, Thanks in advance for help)</em></p>