title: Error 1004 when trying to offset active cell
body: <p>I am trying to offset the active cell until a certain condition is met. What I've written is </p>
  
  <pre><code>Do While ActiveCell.Value &lt;&gt; Worksheets("Unit B").Range("D1").Value  
      ActiveCell.Offset(0, 1).Select
  Loop
  </code></pre>
  
  <p>Can you please help me correct this ?</p>
  
  <hr>
  
  <p>Giving my entire code for reference:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  Dim ddsdata As Range
  
  Dim i As Long
  i = 1
  
  Worksheets("Unit B").Select
  Set ddsdata = Worksheets("Unit B").Range("E3:E35")
  Worksheets("Data Sheet").Select
  Worksheets("Data Sheet").Range("E1").Select
  
  Do While ActiveCell.Offset(0, i) &lt;&gt; Worksheets("Unit B").Range("D1").Value
  i = i + 1
  
  Loop
  
  ActiveCell.Offset(1, i).Select
  ActiveCell.Value = ddsdata
  </code></pre>