title: Excel VBA count cells until a date is found
body: <p>I've got an amount of data copied from a table in a .pdf that when pasted into excel puts it all into one column. There are actually multiple pages each with it's own table (the data is one continuous long table split over multiple pages more accurately) and at the top of each page is a series of lines that I'm not interested in (the same unwanted data is at the top of each page). What I am interested in is re-sorting the data under the headers as it is in the table on the original .pdf document, removing the headers in the process. The data as it has been pasted into one column essentially is a list of items in plain text for x rows, followed by a list of start dates for x rows, and then a list of end dates for x rows, repeated every page.</p>
  
  <p>I've figured out how to count the number of lines I don't want by getting a macro to look for the first piece of data I'm interested in ("AAAA") starting at cell (B2);</p>
  
  <pre><code>Cells(2, 2).Select
  
      For i = 1 To 50
      If ActiveCell = "AAAA" Then
          Exit For
      End If
  
  ActiveCell.Offset(1, 0).Select
  Next i
  
  Cells(2, 3) = i
  
      If i = 51 Then
          Range("B3") = "Cannot find data"
      End If
  </code></pre>
  
  <p>Which starts a search at cell (B2) looking downwards until it finds "AAAA" it then prints how many rows it has moved downwards to find it in cell (C2).</p>
  
  <p>I now wish to be able to start at the cell it has just found [(B34) in this case] and count downwards until it finds the first cell containing a date.</p>
  
  <p>Ultimately I'll need to then count down the same number of cells to find the associated end date and print them all in one row, continuing for the entire column of data.</p>
  
  <p>If anybody could help me with being able to start at the first cell "AAAA" and then count downwards until a date is found, that would be really helpful.</p>