更快地隐藏空行 [英] Faster way to hide empty rows

查看:171
本文介绍了更快地隐藏空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图隐藏列A中单元格的的所有行空白(即为空)。我试图使用以下代码:

I am trying to hide all rows where the value of the cell in Column A is blank (i.e. empty). I was trying to use the following code:

Range("A7:A117").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True

但是,列A中的每个单元格都有一个 VLOOKUP 公式,而 xlCellTypeBlanks 将具有公式的单元格视为空白。

However, every cell in Column A has a VLOOKUP formula and the xlCellTypeBlanks considers a cell with a formula, but no value, not to be blank.

所以我尝试使用以下代码,但速度非常慢。

So I tried using the following code, but it is extremely slow.

For i = 17 To 117
  If ActiveSheet.Cells(i, 1) = "" Then
    ActiveSheet.Cells(i, 1).EntireRow.Hidden = True
End If

如何加快速度?

推荐答案

为什么不尝试AutoFilter:

Why don't you try AutoFilter:

Range("A7:A117").AutoFilter 1, "<>", , , False

这篇关于更快地隐藏空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆