简体   繁体   English

如何从最后一行取消隐​​藏 VBA 中的所有行?

[英]How do I unhide all rows in VBA from the last row?

On the spreadsheet, the LastRow is actually 32, but when I run this sub, it's unhiding everything before Row 30, and leaving both 31 and 32 hidden.在电子表格上,LastRow 实际上是 32,但是当我运行这个子程序时,它会取消隐藏第 30 行之前的所有内容,并隐藏 31 和 32。 Any help?有什么帮助吗?

Dim I As Integer
Dim LastRow As Long
LastRow = Cells(Rows.Count, 4).End(xlUp).Row
For I = 1 To LastRow
    Rows(I).EntireRow.Hidden = False
Next I

LastRow = Cells(Rows.Count, 4).End(xlUp).Row returns last visible row (with data)... LastRow = Cells(Rows.Count, 4).End(xlUp).Row返回最后可见行(带数据)...

In this case will work:在这种情况下将工作:

ActiveSheet.UsedRange.Rows.count

Even if I never recommend using it...即使我从不建议使用它...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM