我有一張評估表。在表中,我必須尋找S,T和U三列。將公式轉換成vba
如果列S包含無效並且列T和U都填滿了,那麼我需要篩選整行。
爲此,我嘗試了下面的代碼。該代碼適用於我。但對於我的其他同事來說,過濾器根據條件不起作用。
列Z被視爲輔助列,根據條件標記爲真或假。如果列T和U都填滿並且S無效,那麼它標記爲false,其餘爲真
我已經在所有模塊之上顯式使用了選項。
任何人都可以提出,我怎麼能克服這個?任何一個可以幫助我的代碼,而無需使用公式
Sub fc()
Dim totalrows As Long
Dim sformula
totalrows = Range("A5").End(xlDown).Row
With Sheets("Evaluation").Range("Z5:Z" & totalrows)
' if the S5 is not equal to invalid and any one of the column T and U are filled, then activate autofilter
sformula = "=AND(S5<>""Invalid"",OR(ISBLANK(T5),ISBLANK(U5)))"
.Formula = sformula
.AutoFilter 26, True
.Value = .Value
End With
End Sub
只要將.Value = .Value移動到自動篩選器上並檢查。 – Sixthsense
@Sixthsense有沒有其他方法?我試圖與它合作 – Jenny