Could anyone help troubleshoot my coding? The If statement requires three separate conditions = true or it checks the next if statement and loop back for the all cells the array. There is no error or output so its difficult to determine the issue, plus I'm very new to VBA so there is probably a better way to accomplish this.
Note: The cells needed in the arrays are not static hence the Find.
Sub test()
Dim i As Integer
Dim col1 As Range, col2 As Range, col3 As Range, col4 As Range, col5 As Range, col6 As Range
Dim c1arr, c2arr, c3arr, c4arr, c5arr, c6arr As Variant
Set col1 = ActiveSheet.Cells.find("Reference", , xlValues, xlWhole)
Set col2 = ActiveSheet.Cells.find("Amount", , xlValues, xlWhole)
Set col3 = ActiveSheet.Cells.find("Action", , xlValues, xlWhole)
Set col4 = ActiveSheet.Cells.find("Reference2", , xlValues, xlWhole)
Set col5 = ActiveSheet.Cells.find("Amount2", , xlValues, xlWhole)
Set col6 = ActiveSheet.Cells.find("Action2", , xlValues, xlWhole)
lastrow = Cells(Rows.Count, col1.Column).End(xlUp).Row
c1arr = Range(Cells(2, col1.Column), Cells(lastrow, col1.Column)).Value
c2arr = Range(Cells(2, col2.Column), Cells(lastrow, col2.Column)).Value
c3arr = Range(Cells(2, col3.Column), Cells(lastrow, col3.Column)).Value
c4arr = Range(Cells(2, col4.Column), Cells(lastrow, col4.Column)).Value
c5arr = Range(Cells(2, col5.Column), Cells(lastrow, col5.Column)).Value
c6arr = Range(Cells(2, col6.Column), Cells(lastrow, col6.Column)).Value
For i = 1 To UBound(c1arr)
If c2arr(i, 1) > 0 And c1arr(i, 1) = c4arr(i, 1) And c1arr(i, 1) = c5arr(i, 1) Then
c6arr(i, 1) = c3arr(i, 1)
Exit For
ElseIf c2arr(i, 1) > 0 And c1arr(i, 1) <> c4arr(i, 1) And c1arr(i, 1) <> c5arr(i, 1) Then
c6arr(i, 1) = "Manual Review"
End If
Next
End Sub
