Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Vlookup probelm

I'm doing a vlookup to find the matching identifier in another excel sheet,
and when it doesn't find the matching identifier, then look for another
identifier in the sheet, if neither are there return a zero. But for some
reason, when it doesn't find the first identifier it doesn't look for the
other, it just returns zero, any idea why?
This is what I have:

For i = 3 To lastRow Step 1
tmp = VariantType.Empty

On Error Resume Next
tmp = LCV.WorksheetFunction.VLookup(LCV.Range("A" & i).Value,
oApp.Range("A1:J" & lastRow2).Value, 10, False)
On Error GoTo 0

If tmp = VariantType.Empty Then
On Error Resume Next
tmp = LCV.WorksheetFunction.VLookup(LCV.Range("B" &
i).Value, oApp.Range("B1:J" & lastRow2).Value, 10, False)
On Error GoTo 0
If tmp = VariantType.Empty Then
LCV.Range("L" & i).Value = 0
Else : LCV.Range("L" & i).Value = tmp
End If
Else : LCV.Range("L" & i).Value = tmp
End If
Next i

Thanks in advance!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Probelm with macro mac Excel Worksheet Functions 5 January 14th 08 07:47 PM
FileCopy Probelm jutlaux Excel Programming 2 November 17th 06 03:58 PM
Hyperlink probelm Glenn Richardson[_2_] Excel Programming 3 August 31st 05 09:24 AM
Hyperlink probelm Glenn Richardson Excel Worksheet Functions 2 August 30th 05 02:26 PM
Range probelm in VB6 K.K.[_2_] Excel Programming 4 July 1st 04 12:07 PM


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"