Asignación de fórmulas con condicionales a macros
Hola, necesito realizar un buscarv con macro pero cuando no encuentra el dato me genera error '13' de tipos, el código es:
Dim Dato As String
Dim rango As Range
Dim Resultado As Variant
Set rango = Sheets("Hoja2").Range("$A$1:$D$30000")
Sheets("Hoja1").Range("A2").Select
Do While ActiveCell.value <> ""
Dato = ActiveCell.value
Resultado = Application.VLookup(Dato, rango, 4, FALSO)
'Resultado = IF(ESENOD(Application.VLookup(Dato, rango, 4, FALSO))=TRUE,"",(Application.VLookup(Dato, rango, 4, FALSO)))
If Resultado <> "" Then
Sheets("Hoja2").Select
ActiveCell.Offset(0, 20).Select
ActiveCell.value = Resultado
ActiveCell.Offset(1, -20).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
Mil Gracias
1 respuesta
Respuesta de Elsa Matilde
1