Loop through each row of a range in Excel

前端 未结 4 1847
闹比i
闹比i 2020-11-28 19:01

This is one of those things that I\'m sure there\'s a built-in function for (and I may well have been told it in the past), but I\'m scratching my head to remember it.

4条回答
  •  日久生厌
    2020-11-28 19:29

    Something like this:

    Dim rng As Range
    Dim row As Range
    Dim cell As Range
    
    Set rng = Range("A1:C2")
    
    For Each row In rng.Rows
      For Each cell in row.Cells
        'Do Something
      Next cell
    Next row
    

提交回复
热议问题