2017-07-17 114 views
0

我有错误type mismatchVBA的Excel搜索从范围和隐藏行值

我在这里做矩阵,如果行包含"x"则代码应该保持连续可见。应该隐藏没有"x"的行。从按钮触发变量hideEmptyRows

If (hideEmptyRows = True) Then 

     For i = 8 To lastRow 

      If Range(Cells(i, 3), Cells(i, lastColumn)).value = "x" Then 
       cell.EntireRow.Hidden = True 
      End If 

     Next i 

    End Ifenter code here 

回答

0

Range类型的对象不具有这样的属性作为Value。您需要遍历整个范围以检查范围内是否有任何单元格的值为“x”。

你应该添加到您的代码:

​​
+0

谢谢伙计!随着你的提示,我继续工作。 – AratioD

+0

不客气:) –