crazyboy037
New Member
- Joined
- May 20, 2015
- Messages
- 2
Hi!
I'm from Spain and I'm tryng to emulate the buscarv function with VBA. I'm using the Vlookup property but it doesn't work. Appears the 2042 error. What I do wrong? I supose that could be something relationed about the format of te cells... but I'm not sure...
The macro retunrs into the Cell I32 a 0 and it's wrong... It should be other number...
I'm from Spain and I'm tryng to emulate the buscarv function with VBA. I'm using the Vlookup property but it doesn't work. Appears the 2042 error. What I do wrong? I supose that could be something relationed about the format of te cells... but I'm not sure...
Code:
Dim Fecha As Date
Dim Disponible As Integer
Dim Disp As Variant
Value As Variant
Rango As Range
Sub PrevDisp_FMT_VLC()
Fecha = Worksheets("PREVISIONES Y PEDIDOS").Range("U29").value
Value = Fecha
Set Rango = worksheets("RESUMEN").Range("A6:BM:1000)
Disp=Application.Vlookup(value, Rango, 7, False)
If IsError(Disp) Then
Disponible =0
Else
Disponible = Disp
End If
Worksheets("PREVISIONES Y PEDIDOS"). Range("I32"). value = Disponible
End Sub
The macro retunrs into the Cell I32 a 0 and it's wrong... It should be other number...
Last edited by a moderator: