2017-07-17 84 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

不客氣:) –