ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VLookup type mismatch (https://www.excelbanter.com/excel-programming/378099-vlookup-type-mismatch.html)

OMAR

VLookup type mismatch
 
Hi,

I have the next:

Private Sub btn4_Click()

Dim magneto As Range
Dim numero
Dim valor As Variant
Dim existe As Boolean

Sheets("info").Visible = True
Set magneto = Worksheets("info").Range("A2:AY65526")
numero = ufConsulta.cboOrden.Value
existe = protege.existe(CStr(numero))

If existe = True Then
ufConsulta.txt33.Value = Application.VLookup(numero, magneto, 1, falso)
'Orden de reparación
ufConsulta.txt34.Value = Application.VLookup(numero, magneto, 2, falso)
'Número de siniestro
....

When the numero's value is something like "96LP" there's no problem.
However, when the value is like "96", then appears a type mismatch error.

What am I doing wrong?

TiA


All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com