Hello, I am relatively new to VBA and am making a tool for work. In this particular part I am trying to pull the correct email from the sheet 'Active Contacts' by first looking for an exact match, then an exact match of the next column over (another contact name), then approximate match in the same order. The loop is supposed to bring the nestedif formula down and stop when there is no more data in the column (4). Right now the first cell is getting solved but the loop isn't moving down, it stays at Range("E3"). Let me know what I can do, thank you!
Code:
Sub NestedIFDYN()
Range("E3").Select
Dim i As Integer
i = 3
Do While Cells(i, 4).Value <> ""
If ActiveCell.Formula = "=VLOOKUP('Enter Data'!R[-1]C[2],'Active Contacts'!R1:R1048576,2,FALSE)<>0" Then
ActiveCell.Formula = _
"=VLOOKUP('Enter Data'!R[-1]C[2],'Active Contacts'!R1:R1048576,2,FALSE)"
ElseIf ActiveCell.Formula = "=VLOOKUP('Enter Data'!R[-1]C[3],'Active Contacts'!R1:R1048576,2,FALSE)<>0" Then
ActiveCell.Formula = "=VLOOKUP('Enter Data'!R[-1]C[3],'Active Contacts'!R1:R1048576,2,FALSE)"
Else
ActiveCell.Formula = "=VLOOKUP('Enter Data'!R[-1]C[2],'Active Contacts'!R1:R1048576,2,TRUE)"
End If
i = i + 1
Loop
End Sub
[End Code]