How to increment a Range object with a Loop
<p>In this code I'm trying to increment two Range object's using .OffSet(1, 0).Activate. </p>

<pre><code>  Function Foundry_check_func(target_cell As Range, result_cell As Range)
    For x = 1 To 20
        If result_cell &lt;= 5 Then
            target_cell = "Value 1"
        ElseIf result_cell &gt;= 10 Then
            target_cell = "Value 2"
        Else: target_cell = "Value 3"
        End If

        With target_cell
        .Interior.Color = RGB(0, 255, 0)
        End With

        target_cell.Offset(3, 0).Activate
        result_cell.Offset(4, 0).Activate
        Debug.Print ("Value: " &amp; result_cell &amp; " Loop: " &amp; x)
    Next x


    ' Don't forget to format target cell at end of loop

End Function


Sub Foundry_check()
    Main = Foundry_check_func(Range("J22"), Range("K22"))
End Sub
</code></pre>

<p>However, I can see using Debug.Print that after each loop, the cell being read does not change. Here's the output: </p>

<pre><code>Value: 1 Loop: 1
Value: 1 Loop: 2
Value: 1 Loop: 3
Value: 1 Loop: 4
Value: 1 Loop: 5
etc.
</code></pre>

<p>I've made a similar macro work using ActiveCell instead of a Range. But in this program I need to OffSet two sets of cells. One to read data (result_cell) and another to write a value based on that data (target_cell). I'm not sure how I could use ActiveCell to offset two different cells in the same loop. </p>

<p>Any help would be appreciated. </p>