Reputation: 128
In the following code, for each range in range is failing. r is not returning a single cell but instead the entire parent range.
I had previously created a class module with a get property called "range". That seemed to be the cause that broke the loop. However I have since removed that module and restarted excel / restarted the computer even. And the loop still fails.
Any ideas?
Private Sub GetIters()
Dim FilterRng As Range
Dim ItersRng As Range
Dim r As Range
Set FilterRng = pFieldRng.Resize(pCountRow + 1, COUNTCOL)
Set ItersRng = FilterRng.Columns(ITERPOS).Offset(1, 0).Resize(pCountRow, 1)
Debug.Print IterRng.Address 'returns $B$2:$B$281
For Each r In IterRng
Debug.Print r.Address 'returns $B$2:$B$281
Next r
End Sub
Upvotes: 0
Views: 136
Reputation: 1983
missed an "s" off the variable?
For Each r In IterRng
should be
For Each r In ItersRng
Apart from the the code is working here
Upvotes: 1