我在 VBA 方面相当薄弱。
我试图在图片中找到表 1 和表 2 的行数。
我试图在下面的 VBA 代码中从 Cell A12
向上计数行(向后工作),
LastRow=sheet("Sheet1").Range("A12").end(xlUp).row
但这似乎不起作用。
Cells(Rows.Count, 1).End(xlUp).Row
将计算行数到 table2
;因此不起作用。您是否有更好的想法/代码来计算表 1 和表 2?
谢谢!
最佳答案
Sub FFF()
Dim rng, cell
Set cell = Cells(Rows.Count, 1).End(xlUp) '//Start cell
Do
Set rng = cell.CurrentRegion
MsgBox "The count of cells in table " & rng.Address & " is: " & rng.Cells.Count
Set cell = rng(1).End(xlUp)
Loop Until cell.Row = 1
End Sub
关于excel - 从指定单元格向上计数行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59445317/