title: Excel VBA to check autofilter for data
body: <p>I need help checking for autofiltered rows not including the header. I want it to give a message box "No records found." then exit sub or continue with copy paste if there are rows beyond the header row. I know I need an If/Else entry after the filter to check for data but I'm having trouble figuring how to check. This code is being done from a UserForm button I created.</p>
  
  <p>Here is my script:</p>
  
  <pre><code>Private Sub Searchbycompanyfield_Click()
  
  If CompanyComboBox1.Value = "" Then
      MsgBox "Please enter a Company to begin search."
      Exit Sub
  End If
  ActiveSheet.Range("$A:$H").AutoFilter Field:=1, Criteria1:=EQDataEntry.CompanyComboBox1.Value, Operator:=xlOr
  Cells.Select
  Selection.Copy
  Sheets("Sheet2").Select
  Range("A5").Select
  ActiveSheet.Paste
  Call MessageBoxYesOrNoMsgBox
  End Sub
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>