Results 1 to 5 of 5

Syntax Iferror Problem

Threaded View

  1. #1
    Registered User
    Join Date
    10-13-2008
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    85

    Syntax Iferror Problem

    Hi,

    I'm trying to use the iferror function in VBA and the whole code is not executing, as the syntax error is being noticed first, and not allowing the whole code to execute. What I want to happen is if the vlookup returns an error, the cell value should be "*". The code is:

    Range("F8").Value = Application.WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(" * " & InputBox("Enter Item Code") & " * ", Range("I86:I1500"), 1, False), "*")
    If I enter a correct entry into the input box, the vlookup works perfectly but if the vlookup returns an error, the syntax error is appearing first, and not allowing the iferror to work. How can I get around this and make sure the iferror returns * if the vlookup doesn't work?

    Cheers,
    Benno
    Last edited by benno87; 10-01-2009 at 12:09 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1