1
我試圖用字符串'hello'或'hi'來隱藏行。但是我在if語句中出現語法錯誤。但是對我來說,任何想法都是正確的?excel中的錯誤如果或聲明
這裏是我的代碼
Private Sub CommandButton1_Click()
Dim BeginRow As Long
Dim EndRow As Long
Dim ChkCol As Integer
BeginRow = 1 'starting row
ChkCol = 2 'column you want to check
EndRow = Range("B1").CurrentRegion.Rows.Count 'get the total number of rows
For RowCnt = BeginRow To EndRow
If (OR(Cells(RowCnt, ChkCol).Value = "hello", Cells(RowCnt, ChkCol).Value = "hi")) Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True 'hide rows
End If
Next RowCnt
End Sub
你嘗試我的建議? – 2014-11-05 14:21:17