If logic where either of two conditions make it true

前端 未结 2 768
渐次进展
渐次进展 2021-01-25 05:01

I am trying to delete a row if cells in column V is not equal to F or V.

This code deletes everything.

For i = RowCo         


        
相关标签:
2条回答
  • 2021-01-25 05:15

    Your logic seems incorrect. By changing the or to an and, you will then be evaluating the proper boolean arithmetic.

    Right now, you are checking not "v" and not "f" which is always false. No matter the input, this will always have answer be true.

    0 讨论(0)
  • 2021-01-25 05:25

    Answer to Else Not working in "If Then Else" in VBA EXCEL

    You need something similar

    Sub SpecificFlatArrears03()
        
        Dim Flat As Variant
        
        Do
            Flat = InputBox("Pl Enter a Flat Number as 3 Digit without Prefix")
            'at this point you should check that Flat meets the required requirements
            Range("h3").Value = Flat
            If (Flat > 100 And Flat < 165) Or (Flat > 200 And Flat < 264) Or (Flat > 300 And Flat < 364) Or Flat = 403 Or Flat = 404 Or Flat = 462 Or Flat = 463 Then
                Range("h4") = WorksheetFunction.Match(Flat, Range("'2020-2021'!d11:d206"), 0)
                Exit Do
            End If
        Loop Until False
        
    End Sub
    
    0 讨论(0)
提交回复
热议问题