title: Delete all rows after first match of value in first row
body: <p>I'm trying to delete all rows after the first match of the value "##Section" in column A.</p>
  
  <p>My spreadsheet looks like this :</p>
  
  <pre><code>blah
  blah
  blah
  ##Section
  blep
  blep
  blep
  ##Section
  Hi
  hi
  ...
  </code></pre>
  
  <p>Here's my current code (not working) :</p>
  
  <pre><code>   Dim rng As Range
      Dim lastRow As Long
  
      With Sheets("import")
          'find Terminations
          Set rng = .Range("A:A").Find(what:="##Section", after:=.Range("A1")).Row
          'if ##Section NOT found - exit from sub
          If rng Is Nothing Then Exit Sub
          'find last row
          If Application.WorksheetFunction.CountA(.Cells) &lt;&gt; 0 Then
              lastRow = .Cells.Find(what:="*", _
                            after:=.Range("A1"), _
                            Lookat:=xlPart, _
                            LookIn:=xlFormulas, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlPrevious, _
                            MatchCase:=False).Row
          Else
              lastRow = 1
          End If
          'I use lastRow + 1 to prevent deletion "##Section" when it is on lastrow
          .Range(rng.Row + 1 &amp; ":" &amp; lastRow + 1).Delete Shift:=xlUp
      End With
  </code></pre>