Thread: VLookup erro
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default VLookup erro

There's an immediate if (iif) that works a lot like an If statement inside a
cell on a worksheet.



Don Guillett wrote:

Without looking any further maybe too many iiiiii's in IF

--
Don Guillett
SalesAid Software

"Miguel" wrote in message
...
Hi,

I use VLookp in lines of the programmig however, the code is get same

error.
Option Explicit
4 5 8

9
d0 n1 d0 n1
d1 n2 d1 n2
d3 n3 d3 n3
d4 n4 d4 n4
d5 n5 d20 erro
d6 n6
d7 n7

Sub Macro1()
Dim i As Integer
Dim a, b As String

Dim rangea, rangeb As range


Set rangea = range(Cells(2, 4), Cells(20, 5))
Set rangeb = range(Cells(2, 8), Cells(20, 8))


For i = 0 To 30
a = Cells(2 + i, 8)
Cells(2 + i, 9) =

iif(IsError(Application.WorksheetFunction.VLookup( a, rangea, 2, False)), 1,_
Application.WorksheetFunction.VLookup(a, rangea, 2, False))
Next i
End Sub




Run-time error '1004':

VLookup method of Range class failed

Can someone help me with this?





--

Dave Peterson