title: Using the "Cells" function in excel vba
body: <p><em>I am trying to select a cell in excel using vba through the use of the range function.</em></p>
  
  <p>I have done this many times before even with using variables to specify the range instead of just numbers.  </p>
  
  <p>However, I cannot seem to select a range using the cells function.  </p>
  
  <p>I know that this is possible as I have done much research and have seen other people's code that will successfully run using this function.  </p>
  
  <p>Below is the syntax I'm using to try and select the range (which is only 1 cell).  </p>
  
  <p>Additionally, when i run the code i get the following message: </p>
  
  <p><strong>"Run-time error '1004': Method of 'Range' of object'_Global' failed".</strong></p>
  
  <p>Thank you for any and all help.</p>
  
  <pre><code>Dim item As String
  Dim itempaste As Boolean
  Dim itemcnt As Integer
  
  itemcnt = 1
  itempaste = False
  Range("X3").Select
  Do
      item = ActiveCell.Value
      If item &lt;&gt; "" Then
          Range("A18").Select
          Do
              If ActiveCell.Value = "" Then
                  ActiveCell.Value = item
                  itempaste = True
              Else
                  ActiveCell.Offset(1, 0).Select
              End If
          Loop Until itempaste = True
      End If
      itemcnt = itemcnt + 2
      Range(Cells(1, (21 + itemcnt))).Select
  Loop Until itemcnt = 11
  </code></pre>