loop through cells in named range

后端 未结 3 2009
旧时难觅i
旧时难觅i 2020-12-20 20:17

I am trying to write code that will loop through all cells in a range. Eventually I want to do something more complicated, but since I was having trouble I decided to creat

3条回答
  •  我在风中等你
    2020-12-20 20:53

    Try this, instead:

    Sub foreachtest2()
    Dim c As Range
    Range("A1:A3").Name = "Rng"
    For Each c In Range("Rng")
        MsgBox (c.Address)
    Next
    End Sub
    

提交回复
热议问题