title: Excel Visual Basic Application-defined or Object-defined error
body: <p>So I have two excel worksheets in one workbook. There is a bigger one called "data" and smaller one called "Sheet1." The code below first creates a new sheet called "DailyReport" and compare the two sheets. If one cell from the Column B of the "Sheet1" is the same as one cell in the column B of "data", it should copy that row in "data" to the new sheet "DailyReport." Below is the code. It is a Macro. Now it keeps saying "Invalid procedure call or argument"error. </p>
  
  <pre><code>Sub DailyReportGenerator()
  Sheets.Add.Name = "DailyReport"
  
  Application.ScreenUpdating = False
  
  Dim StartNumber As Integer
  Dim EndNumber As Integer
  Dim StartNumber2 As Integer
  
  EndNumber = 9999
  
  For StartNumber = 1 To EndNumber
      For StartNumber2 = 1 To EndNumber
  
      If Worksheets("Sheet1").Cells(StartNumber, "B").Value = Worksheets("data").Cells(StartNumber2, "B").Value Then
          Sheets("data").Range(Sheets("data").Cells(StartNumber, "B"), Sheets("data").Cells(StartNumber, "CA")).Copy Sheets("DailyReport").Cells("StartNumber, B")
      End If
  
      Next StartNumber2
  Next StartNumber
  
  Application.ScreenUpdating = True
  End Sub
  </code></pre>