查找所有实例并隐藏行

时间:2015-08-25 20:55:03

标签: excel vba

我有一个列可以取值x0

x
x
0
0
x
0

我正在寻找一个快速宏,它会找到所有x值并隐藏这些行。我可以使用For each cell .. next来做到这一点,但我认为必须有更快的方式使用数组或其他东西。

2 个答案:

答案 0 :(得分:3)

您可以使用SpecialCells()功能查找文本值。然后,只隐藏那些行。

假设您要检查列A,这应该可以解决问题:

Range("A:A").SpecialCells(xlCellTypeConstants, xlTextValues).EntireRow.Hidden = True

修改:Per @ Jeeped的评论

如果您正在使用公式并且公式返回0而不是"0",那么这应该有效:

Range("A:A").SpecialCells(xlCellTypeFormulas, xlTextValues).EntireRow.Hidden = True

答案 1 :(得分:0)

以下假设A1中的列标题标签。

public void sendEncryptedKeyToServer () {

    // the next line is almost certainly part of the problem
    // but I don't know how to fix!!!
    //AppComponent component = DaggerAppComponent.builder().appModule(new AppModule()).build(); //you don't need this here at all

    //AESCipherService cipherService = component.provideCipherService(); //already provided in constructor

这只是隐藏小箭头的AutoFilter Method。您可以使用传统的取消隐藏命令或数据取消隐藏行►排序&过滤器►清除或只是关闭自动过滤器。