D
David
Excel 2010 - VBA
Consider the following example:
'**********************************
Public Sub test()
Dim currev As Variant
Range("A1:C4") = "a value"
Debug.Print Range("A1").CurrentRegion.Columns(1).Address
' Only one iteration!? Why?
For Each currev In Range("A1").CurrentRegion.Columns(1)
Debug.Print currev.Address
Next
' that's what I want to get
For Each currev In Range(Range("A1").CurrentRegion.Columns(1).Address)
Debug.Print currev.Address
Next
End Sub
'*****************************
Why in the first for loop I get only one iteration? I'm iterating over a
range like in the secondo loop.
Please somebody clarify.
TIA
David
Consider the following example:
'**********************************
Public Sub test()
Dim currev As Variant
Range("A1:C4") = "a value"
Debug.Print Range("A1").CurrentRegion.Columns(1).Address
' Only one iteration!? Why?
For Each currev In Range("A1").CurrentRegion.Columns(1)
Debug.Print currev.Address
Next
' that's what I want to get
For Each currev In Range(Range("A1").CurrentRegion.Columns(1).Address)
Debug.Print currev.Address
Next
End Sub
'*****************************
Why in the first for loop I get only one iteration? I'm iterating over a
range like in the secondo loop.
Please somebody clarify.
TIA
David