VBA Vlookup Error


Skip Bisconer

In Excell 2007 I am formating an imported CSV file of credit card
transactions into and existing workbook. I used the foloowing code to place a
lookup in column B:

Sheets(1).Range("B2").Formula = "=(VLOOKUP(A2,GLCode,2,"")"

This works perfectly and further down in the code it is placed in all the
cells in B:B to the end of transactions. The problem for me is that A:A in
the onset is blank so the lookup returns #NA, whic is expected. But i parse
these lines of data out into separate worksheets from Access and email then
to each individual cardholder for their input intl column A:A. Outside of VBA
I would use IFERROR(Vlookup,"") and be on my way but I cannot get this to
work in code.

The following code is my unsucessful attempt that gives me an
Application-defined or Object-defined Error 1004 halt. I just can't figure
where to put Application. at and make I work.

Sheets(1).Range("B2").Formula = "=IFERROR(VLOOKUP(A2,GLCode,2,"")"

Any suggestions would be helpful

Using Office 2003 Pro
2007 Student version



Mike H

Try this

Sheets(1).Range("B2").Formula =


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