我正在尝试加快我的 VBA 代码,但不知道该怎么做。到目前为止,最慢的任务是我隐藏空行的循环。(我有几个垂直对齐的数据透视表,当添加新数据时,我必须留出空间让它们扩展。)
Public Sub HideRows(list1 As Range)
Dim cell As Range
For Each cell In list1
cell.EntireRow.Hidden = (cell.Value = "")
Next cell
End Sub
Public Sub UnhideRows(list1 As Range)
Dim cell As Range
For Each cell In list1
If (cell.Value <> "") Then cell.EntireRow.Hidden = False
Next cell
End Sub