View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben McBen Ben McBen is offline
external usenet poster
 
Posts: 56
Default VBA code to erase an array element returning Error 2042 ???

There are various approaches, but I think it would be best if you just change
the underlying data - by wrapping you vlookup in an "if" to eliminate any
errors....

"Patachoup" wrote:

hello,

below is my code, I need to return Min and Max Values, but it doesn't work
if any value in the array returns error2042:

Thx

-----------------------
For iSrs = 1 To nSrs
'these are chart series
Yvals = ActiveChart.SeriesCollection(iSrs).Values
nVals = ActiveChart.SeriesCollection(iSrs).Points.Count

'test every single point in the serie
For iVals = 1 To nVals
If IsError(Yvals(iVals)) Then
Yvals.Points(iVals).Delete 'HERE is the line I
need to change!
End If
Next

Ymax(iSrs) = WorksheetFunction.max(Yvals)
Ymin(iSrs) = WorksheetFunction.min(Yvals)
Next
-----------------------




"Ben McBen" wrote:

I think we need some more background - is it a 1 or 2 dim array, do you
merely wnt to blank out the entry or actually delete it.

If its 1 dimensional, then the "Filter" function should be useful. If its
2d I think you will have to resort to more VBA.

Please also see:

http://www.ozgrid.com/forum/showthread.php?t=30439

"Patachoup" wrote:

Hello,

How to easily erase an single array element returning "Error 2042" using VBA
code ?

Thx in advance