dimanche 8 novembre 2020

If condition with multiple conditions and columns

I have a list of stock column 27 is the bin and column 42 is the quantity. The argument is as follows If column 27 = SO000 and 42 = 0 then exclude them from the list this argument below works just fine for the 1 argument:

With WbCSV.Sheets(1)
    vDB = .UsedRange
    For i = 1 To UBound(vDB, 1)
        'AA column = 27, AP column = 42
        If vDB(i, 27) = "SO0000" And vDB(i, 42) = 0 Then
        Else
            'Get the contents corresponding to the dynamic array. Bring the matrix to the inverted state.
            n = n + 1
            ReDim Preserve vR(1 To 5, 1 To n)
            vR(1, n) = vDB(i, 1)
            vR(2, n) = vDB(i, 2)
            vR(3, n) = vDB(i, 3)
            vR(4, n) = vDB(i, 27)
            vR(5, n) = vDB(i, 42)
        End If
    Next i
End With
'Colse the text file
WbCSV.Close (0)
    
'The dynamic array is recorded in sheet2.Bring the row to the inverted state.
With Ws
    .UsedRange.Clear
    .Range("a1").Resize(n, 5).Value = WorksheetFunction.Transpose(vR)
End With
Worksheets("Sheet2").Columns("A:E").AutoFit
Application.ScreenUpdating = True

But now I am stuck there is more arguments I need to add. If column 27 = WG0000 and col 42 = 0 then exlcude items. And SR0000 = 0 exclude from list.

Can someone please help me? Because I am not sure how to add more arguments

Aucun commentaire:

Enregistrer un commentaire