View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Help with Vlookup in VBA

Hi
try
Dim vres
For i = 1 To 10
vres=Application.VLookup(ActiveCell.Offset(i, 0).Value,
Worksheets("ListePrix").Range("A:d"), 4, False)
if iserror(vres) then
vres=0
CoutUnitaire(i) = vres
Next i
MsgBox CoutUnitaire(1)
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Hi I need some help on Vlookup in VBA. I don't know why, but I have

an
error with the function.

Dim CoutUnitaire(10) As Double
Dim i As Integer


Worksheets("Mold base").Activate
Range("c17").Activate

For i = 1 To 10

CoutUnitaire(i) =
Application.WorksheetFunction.VLookup(ActiveCell.O ffset(i, 0).Value,
Worksheets("ListePrix").Range("A:d"), 4, False) ' I want to select
Column A To D completly
Next i
MsgBox CoutUnitaire(1)
End Sub

gracias


---
Message posted from http://www.ExcelForum.com/