#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default #N/A

using Vlookup function in an excel sheet, the result in some cells is #N/A.
I am writing a macro to find and process these cells but if I write "If
range("A1").value = "#N/A" I am getting an error . How can I identify these
cells in a macro.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default #N/A

writing a macro is nice..

and could look like:

dim rngErrors as range
on error resume next
set rngErrors = Activesheet.Cells.Specialcells( _
xlCellTypeFormulas,xlErrors)
if rngerrors is nothing then
'ok
else
msgbox "you've got " & rngerrors.count & _
" errors on your sheet"
endif


Finding them manually is a piece of cake
(and basically is what my code does)

press F5 (goto)
click special
select formula / errors
press enter




but why not change your formulas to handle the error ?

=if(iserror(vlookup(val;range;col;false));"-";vlookup
(val;range;col;false))


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"raymond gahan" wrote:

using Vlookup function in an excel sheet, the result in some cells is
#N/A. I am writing a macro to find and process these cells but if I
write "If range("A1").value = "#N/A" I am getting an error . How can
I identify these cells in a macro.




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



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