Re: [Excel 2010] For Each behavior that I don't understand

Discussion in 'Microsoft Excel Programming' started by James Ravenswood, Aug 19, 2012.

  1. The first loop is a loop over columns and there is only one. COnsider:

    Public Sub test()

    Dim currev As Variant

    Range("A1:C4") = "a value"

    For Each currev In Range("A1").CurrentRegion.Columns(1)
    MsgBox currev.Address
    Next

    For Each currev In Range("A1").CurrentRegion.Columns(1).Cells
    MsgBox currev.Address
    Next

    End Sub
     
    James Ravenswood, Aug 19, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TOM

    I dont understand....

    TOM, Jul 8, 2004, in forum: Microsoft Excel Programming
    Replies:
    4
    Views:
    198
    Ron Rosenfeld
    Jul 8, 2004
  2. N E Body

    dont understand compile error

    N E Body, Nov 26, 2004, in forum: Microsoft Excel Programming
    Replies:
    4
    Views:
    316
    JE McGimpsey
    Nov 26, 2004
  3. Thomas
    Replies:
    3
    Views:
    189
    Don Guillett
    Sep 26, 2005
  4. Darrell
    Replies:
    5
    Views:
    1,713
    Darrell
    Jan 12, 2010
  5. Don Guillett

    Re: [Excel 2010] For Each behavior that I don't understand

    Don Guillett, Aug 19, 2012, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    236
    Don Guillett
    Aug 19, 2012
Loading...

Share This Page