#N/A

  • Thread starter Thread starter raymond gahan
  • Start date Start date
R

raymond gahan

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.
 
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 >
 
Back
Top