excel-vba 获取范围中最后一个单元格的行
示例
'if only one area (not multiple areas):
With Range("A3:D20")
Debug.Print.Cells(.Cells.CountLarge).Row
Debug.Print.Item(.Cells.CountLarge).Row 'using .item is also possible
End With 'Debug prints: 20
'with multiple areas (also works if only one area):
Dim rngArea As Range, LastRow As Long
With Range("A3:D20, E5:I50, H20:R35")
For Each rngArea In .Areas
If rngArea(rngArea.Cells.CountLarge).Row > LastRow Then
LastRow = rngArea(rngArea.Cells.CountLarge).Row
End If
Next
Debug.PrintLastRow 'Debug prints: 50
End With
热门推荐
10 简单生日祝福语简短大全
11 放射医生祝福语简短精辟
12 喜得孙子的祝福语简短
13 家长毕业祝福语简短 励志
14 小朋友六一祝福语简短
15 新年祝福语姨姨简短
16 喜欢表姐结婚祝福语简短
17 夏至问候客户祝福语简短
18 22届高考祝福语简短