Yet another #N/A question

jgarland

Board Regular
Joined
Nov 6, 2005
Messages
50
I have tried for days to insert "ISERROR" OR "ISNA" into the following code in order to get rid of any #N/A errors but nothing I do works. Can anyone give me a clue as to how to do it?

The following line of VBA code inserts a VLOOKUP formula in a specific cell. It works perfectly but when there is no match I get the dreaded #N/A.

rngCell.Offset(0, -124).FormulaR1C1 = "=IF(RC[124]=""Y"",VLOOKUP(RC[3],'C:\Documents and Settings\Rgdjergar\Desktop\2 Autocorrect Database master.xls'!data1,2,FALSE),"""")"
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Code:
rngCell.Offset(0, -124).FormulaR1C1 = "=IF(ISNA(IF(RC[124]=""Y"",VLOOKUP(RC[3],'C:\Documents and Settings\Rgdjergar\Desktop\2 Autocorrect Database master.xls'!data1,2,FALSE),"""")),"",IF(RC[124]=""Y"",VLOOKUP(RC[3],'C:\Documents and Settings\Rgdjergar\Desktop\2 Autocorrect Database master.xls'!data1,2,FALSE),""""))"
 
Upvote 0
Thanks for the quick response but I get a Windows "Runtime error '1004' - Application-defined or object-defined error" on this line.
 
Upvote 0
Got it working. I added 2 additional quotation marks. See below

rngCell.Offset(0, -124).FormulaR1C1 = "=IF(ISNA(IF(RC[124]=""Y"",VLOOKUP(RC[3],'C:\Documents and Settings\Rgdjergar\Desktop\2 Autocorrect Database master.xls'!data1,2,FALSE),"""")),"""",IF(RC[124]=""Y"",VLOOKUP(RC[3],'C:\Documents and Settings\Rgdjergar\Desktop\2 Autocorrect Database master.xls'!data1,2,FALSE),""""))"

Thanks again for your help.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top