摘要:我有一大堆不需要的列的電子表格。因爲新的列可能會在未來添加我刪除任何<>
必要的列。如果或聲明始終爲真
問題:我有一個很長的If Or
聲明低於我使用,但它總是如此。我試圖在Or
和許多其他括號變體之間放置括號,但沒有一個是正確的。在括號的一種變體下,陳述總是錯誤的,但這是我收到的唯一改變。
代碼:
If (Cells(4, i).Value <> "BATCH_ID" Or Cells(4, i).Value <> "Indicative" Or Cells(4, i).Value <> "Company Code" Or Cells(4, i).Value <> "Policy Num" Or Cells(4, i).Value <> "Numeric Amount" Or Cells(4, i).Value <> "Legal Amount" Or Cells(4, i).Value <> "PAYMENT_AMT") Then
ActiveCell.EntireColumn.Delete
End If
我在做什麼錯在這裏?提前致謝!
嘗試使用AND?因爲OR只需要1個條件是真/假來執行。 – CustomX