title: VBA Excel - Compile Error Object Required
body: <p><strong>Disclosure: I'm fairly inexperienced at coding of most sorts but have a reasonable understanding of the logic behind it and quite often just need a little push with getting syntax's right etc.</strong></p>
  
  <p><strong>I posted the same code earlier but with a different problem and have no discovered this issue so I thought it best to create a new question for it</strong></p>
  
  <p><strong>Objective:</strong> What I'm trying to do is create a spreadsheet where across the top row is a list of consecutive dates. In the first few columns is data for bills etc. What I want my macro to do is look at the amount of a bill, the start and end dates and the frequency of the bill (weekly/monthly etc) and then populate the cells in that same row in the columns of the dates where the bill is due. I've spent the last day coming up with this code and I was pretty happy with it until I went to run it. I've already got rid of a few bugs where I was using a variable.Value which apparently doesn't exist and I had messed up the syntax for Cells(row, column).</p>
  
  <p>The problem that I'm coming up against now is Compile Error: Object Required on this line: </p>
  
  <pre><code>Set dateAddress = Range("J1:AAI1").Find(currentDate, LookIn:=xlValues).Address 
  'find the current date within the range of dates in row 1
  </code></pre>
  
  <p>What that line is supposed to be doing is searching across all the dates in the first row for that 'currentDate' and then storing that as dateAddress so that I can then use the dateAddress.Column in the next line of code along with the currentRow, to find the right cell that is to be populated with the bill amount.</p>
  
  <p>Am I being clear enough? My code is below.</p>
  
  <p>My Code: </p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim currentDate As Date
  Dim currentRow As Integer
  Dim repeatuntilDate As Date
  Dim repeatuntilRow As Integer
  Dim dateAddress As Date
  currentRow = 3 'First row of entries
  repeatuntilRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row 'Last row of entries
  While currentRow &lt; repeatuntilRow 'Loop from first row until last row of entries
  currentDate = Cells(currentRow, "G").Value 'Set Start Date
  repeatuntilDate = Cells(currentRow, "H").Value 'Set End Date
      While currentDate &lt;= repeatuntilDate 'Loop from Start Date until End Date
          Set dateAddress = Range("J1:AAI1").Find(currentDate, LookIn:=xlValues).Address 'find the current date within the range of dates in row 1
          Cells("dateAddress.Column,currentRow").Value = Cells("D,currentRow").Value 'Populate cell with amount
          'Increment the currentDate by the chosen frequency
          If Cells(currentRow, "E").Value = "Weekly" Then
              currentDate = DateAdd("ww", 1, currentDate)
          ElseIf Cells(currentRow, "E").Value = "Fortnightly" Then
              currentDate = DateAdd("ww", 2, currentDate)
          ElseIf Cells(currentRow, "E").Value = "Monthly" Then
              currentDate = DateAdd("m", 1, currentDate)
          ElseIf Cells(currentRow, "E").Value = "Quarterly" Then
              currentDate = DateAdd("q", 1, currentDatee)
          ElseIf Cells(currentRow, "E").Value = "6 Monthly" Then
              currentDate = DateAdd("m", 6, currentDate)
          ElseIf Cells(currentRow, "E").Value = "Annually" Then
              currentDate = DateAdd("y", 1, currentDate)
         ' ElseIf Cells(currentRow,"E").Value = "Once off" Then
             ' Exit While
          End If
      Wend
      currentRow = currentRow + 1 'Once row is complete, increment to next row down
  Wend
  End Sub
  </code></pre>