Hi Guys,
Having an issue trying to get my VBA Vlookup to work as it keeps bringing up #NAME? in the box, and the VBA code is putting a @"E2"..
After every row, i'd like it to go down one step and increase the variable. Hence the need for my Integer. Screenshot below
Below is my loop
Any help would be appreciated! I've been racking my brains!
Cheers
Having an issue trying to get my VBA Vlookup to work as it keeps bringing up #NAME? in the box, and the VBA code is putting a @"E2"..
After every row, i'd like it to go down one step and increase the variable. Hence the need for my Integer. Screenshot below
export (4).xlsx | |||||||
---|---|---|---|---|---|---|---|
J | K | L | M | N | |||
1 | Port Connect Vessel | Port Connect Voyage | Port Connect ETA | Port Connect Activated | Port Connect Location | ||
2 | #N/A | #N/A | #N/A | #N/A | #NAME? | ||
3 | OOCL BUSAN | 522S | 22/06/2022 5:00 | 4/06/2022 10:19 | Vessel | ||
4 | TORONTO TRADER | 125W | 13/06/2022 5:00 | 30/05/2022 7:40 | Vessel | ||
5 | TORONTO TRADER | 125W | 13/06/2022 5:00 | 30/05/2022 7:41 | Vessel | ||
ag-grid |
Cell Formulas | ||
---|---|---|
Range | Formula | |
J2:J5 | J2 | =VLOOKUP($H2&$E2,Sheet1!$A:$BC,7,FALSE) |
K2:K5 | K2 | =VLOOKUP($H2&$E2,Sheet1!$A:$BC,8,FALSE) |
L2:L5 | L2 | =VLOOKUP($H2&$E2,Sheet1!$A:$BC,49,FALSE) |
M2:M5 | M2 | =VLOOKUP($H2&$E2,Sheet1!$A:$BC,55,FALSE) |
N2 | N2 | =VLOOKUP('E2',Sheet1!B:BC,5,FALSE) |
N3:N5 | N3 | =VLOOKUP($H3&$E3,Sheet1!$A:$BC,9,FALSE) |
Below is my loop
VBA Code:
Range("N2").Select
For i2 = 2 To 1000
'If Range("N" & i2).Value = "#N/A" Then
If IsError(Range("N" & i2).Value) = True Then
Range("N" & i2).Value = "=VLOOKUP(E" & i2 & ",Sheet1!C[-12]:C[41],5,FALSE)"
End If
If IsError(Range("N" & i2).Value) = False Then
If Range("N" & i2).Value = "" Then
Exit For
End If
End If
Next i2
Cheers