LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default VBA VLOOKUP AND No Value Match

Hi,

I'm working on a program which uses the VLOOKUP function. I have some account
numbers on one sheet (Sheet2) and want to see if there are correspoding
inventory amounts on another sheet(Sheet1). Things work OK if there are
inventory amounts. These numbers are placed next to the proper account number
on Sheet2. However, in some cases the an account number found on Sheet2 is not
found on Sheet1. . In that case, I want to leave the cell on Sheet2 next to
an account number which does appear on Sheet1 blank. Nothing will appear in
it. So far, I have been unable to do this. Here is a bit of my program.

Sub ZOO()

Cells(5, 8) = WorksheetFunction.VLookup(ActiveSheet.Range("A2"), _
Worksheets("Sheet1").Range("A2:C4"), 2, 0)
End Sub

From what I have read, I have to replace the last zero with the word "FALSE"
and use an IF(ISNA...code to do what I want. I first tried the putting a
"FALSE" in the program, which, I believe, should have placed "N/A" next to any
account which did not have an inventory amount on sheet 1. That does not work.
When I put in an account number in Sheet2 which is not on Sheet1 and run the
program, I do not get a "FALSE" on Sheet 2 but an error message "400." I
stopped there and have not attempted to include the "IF(ISNA..." code in the
VLOOKUP function. Can anyone tell me what I have done wrong and how I can get
the VLOOKUP to put a blank in a cell in Sheet2 next to an account number if the
program cannot find that account number on Sheet 1?

Thanks

 
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
vlookup retunrning a match, when not a match... Dave Peterson Excel Worksheet Functions 1 October 2nd 08 11:22 PM
vlookup retunrning a match, when not a match... mark Excel Worksheet Functions 4 October 2nd 08 10:39 PM
vlookup retunrning a match, when not a match... Niek Otten Excel Worksheet Functions 0 October 2nd 08 09:00 PM
second or third match in vlookup() or Match() Dan Excel Worksheet Functions 5 June 3rd 08 07:17 PM
index Match, or Vlookup Match.. news.transedge.com Excel Worksheet Functions 1 August 3rd 07 02:00 AM


All times are GMT +1. The time now is 10:00 PM.

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

About Us

"It's about Microsoft Excel"