Double Vlookup Problem

N

NewToVB

This is a random issue, but I'm hoping some of you have experienced it before
and will be able to help. I'm using Visual Studio 2005 but its very similar
to VBA so any feedback will be very helpful. oApp and LCV refer to excel
applications. Ok I'm trying to do 2 vlookups using 2 different spread
sheets. My first Vlookup works fine:

On Error Resume Next
tmp = oApp.WorksheetFunction.VLookup(oApp.Range("A" & i).Value,

LCV.Range("A3:H" & lastRow2).Value, 8, False)
On Error GoTo 0


then when I have to do another vlookup:


On Error Resume Next
tmp1 = LCV.WorksheetFunction.VLookup(LCV.Range("A" & n).Value,
oApp.Range("A3:F" & lastRow).Value, 2, False)
On Error GoTo 0


tmp1 returns nothing...although the value is there, it won't let me search
within a table array that has already been referred to in another vlookup.
Even when I try it manually in excel it doesn't work. The reason I'm doing
this is because I'm adding rows to oApp from LCV that aren't there. Any
logical ideas around this? Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top