不二周助 发表于 2017-2-16 21:13
看了您的回复自己想了一下想明白了,遍历第一列的所有单元格可以用For Each cel In rng.Columns(1).Cells, ...
Sub test1()
Dim rng As Range
Set rng = Range("A1:C5")
Call test2(rng.Rows)
Call test2(rng.Columns)
Call test2(rng.Columns(1))
Call test2(rng.Columns(1).Cells)
End Sub
Sub test2(temp As Range)
Dim cel As Range
Debug.Print "-------------------"
For Each cel In temp
Debug.Print cel.Address(0, 0)
Next
End Sub
不二周助 发表于 2017-2-16 21:13
看了您的回复自己想了一下想明白了,遍历第一列的所有单元格可以用For Each cel In rng.Columns(1).Cells, ...
Sub test1()
Dim rng As Range
Set rng = Range("A1:C5")
Call test2(rng.Rows)
Call test2(rng.Columns)
Call test2(rng.Columns(1))
Call test2(rng.Columns(1).Cells)
End Sub
Sub test2(temp As Range)
Dim cel As Range
Debug.Print "-------------------"
For Each cel In temp
Debug.Print cel.Address(0, 0)
Next
End Sub