title: The value of a range that is variable
body: <p>I have a code which loops to the Sheet(&quot;Overview&quot;) if the value of Cells(Y,X) is equal to  &quot; &quot; then Y = Y + 1 otherwise the rest. The code runs fault on the part</p>
  <pre><code>If Range(Cells(Y,X).Address).Value = &quot;&quot; Then
  </code></pre>
  <p>If I put for instance &quot;H4&quot; in it works but not like this. What am I doing wrong with the Cells refence?</p>
  <p>The whole code for the loop is:</p>
  <pre><code>Sub Maandag1()
  
  Dim X As String
  Dim Y As String
      X = 8
      Y = 4
  
      
      Do While Y &lt;= 4
          
          If Sheets(&quot;Overview&quot;).Range(Cells(Y, X).Address).Value = &quot; &quot; Then
              Y = Y + 1
          Else
              With Sheets(&quot;Controle&quot;)
                  .Range(&quot;B7&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X).Address).Value
                  .Range(&quot;B8&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X + 1).Address).Value
                  .Range(&quot;B13&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X + 2).Address).Value
                  .Range(&quot;B18&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X + 3).Address).Value
                  .Range(&quot;B23&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X + 4).Address).Value
                  .Range(&quot;B28&quot;).Value = Sheets(&quot;Overview&quot;).Range(Cells(Y, X + 5).Address).Value
              End With
              
              Y = Y + 1
          End If
      Loop
          
  End Sub
  
  </code></pre>