_Br_10
02-22-2023, 09:06 AM
Hi everyone,
I want to use de function "vlookup" on vba, but when the macro cannot search the value X on page ("CNM_ABER") i pretend that the variable y will be EMPTY. What you recommended that i do?
In this moment i have this code:
For i = 1 To 169
Worksheets("CNM_LIB").Select
x = Cells(1 + i, "F").Value
Worksheets("CNM_ABER").Select
On Error Resume Next
y = WorksheetFunction.VLookup(x, Range("F1:N221"), 8, False)
'y = WorksheetFunction.IfError(WorksheetFunction.VLookup(x, Range("F1:N221"), 8, False), "")
On Error GoTo 0
End Sub
I want to use de function "vlookup" on vba, but when the macro cannot search the value X on page ("CNM_ABER") i pretend that the variable y will be EMPTY. What you recommended that i do?
In this moment i have this code:
For i = 1 To 169
Worksheets("CNM_LIB").Select
x = Cells(1 + i, "F").Value
Worksheets("CNM_ABER").Select
On Error Resume Next
y = WorksheetFunction.VLookup(x, Range("F1:N221"), 8, False)
'y = WorksheetFunction.IfError(WorksheetFunction.VLookup(x, Range("F1:N221"), 8, False), "")
On Error GoTo 0
End Sub