#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA Vlookup Error

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


--Skip
Using Office 2003 Pro
2007 Student version
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default VBA Vlookup Error

Try this

Sheets(1).Range("B2").Formula =
"=IF(ISNA(VLOOKUP(A2,GlCode,2)),"""",VLOOKUP(A2,Gl Code,2))"

Mike

"Skip Bisconer" wrote:

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


--Skip
Using Office 2003 Pro
2007 Student version

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
vlookup error... Rajmahal Excel Worksheet Functions 3 September 23rd 07 02:32 AM
Vlookup #N/A Error Mike Excel Worksheet Functions 4 August 21st 07 03:49 PM
REF# error using VLOOKUP Amy Excel Worksheet Functions 8 May 18th 06 01:06 AM
VLookup N/A Error WandaSG Excel Discussion (Misc queries) 5 December 12th 05 07:48 PM
#N/A error with VLOOKUP Michelle Tucker Excel Discussion (Misc queries) 4 December 14th 04 01:23 PM


All times are GMT +1. The time now is 08:21 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"