Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default other type values in array.

Hi all,

I pass a range of cells to my function (it is called "Atteso" ).
Inside the function I must recognize if its elements contain non numeric values to prevent strange
behaviour.
I tried the usufel IsNumeric but it seems that empty cells pass the IsNumeric test. I tried also
IsNull but the problem persists. Below I report the part of code:

If IsNumeric(Atteso(i)) Or Not IsNull(Atteso(i)) Then
tmp = prob_weibull(Atteso(i), Atteso(i - 1), ParA, ParB)
If tmp < 0 Then Ret_value = Ret_value + (osserv(i) - tmp) ^ 2 / tmp
End If

and relative called procedure if wanted

Function prob_weibull(x2, x1, ParA, ParB As Double) As Double
With Application.WorksheetFunction
prob_weibull = .weibull(x2, ParA, ParB, True) - .weibull(x1, ParA, ParB, True)
End With
End Function

Debugging the function step by step I noted that it crashes when the debug window reports to me no
values for Atteso(5) (nor numeric neither null string "" ). What does it mean? Is Atteso(5) null?
And why it passses the control "Not IsNull(Atteso(5))"?
Being more precise Atteso(5) refers to untouched cell (any kind of formulas inside)

Which controls I must do to allow crashes to my code?

I hope is all well explained.

Thanks for all suggestions, Alex.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default other type values in array.

Use isempty to test for an empty cell

if isnumeric(atteso(i)) and not isempty(atteso(i)) then

--
Regards,
Tom Ogilvy

"y" wrote in message
...
Hi all,

I pass a range of cells to my function (it is called "Atteso" ).
Inside the function I must recognize if its elements contain non numeric

values to prevent strange
behaviour.
I tried the usufel IsNumeric but it seems that empty cells pass the

IsNumeric test. I tried also
IsNull but the problem persists. Below I report the part of code:

If IsNumeric(Atteso(i)) Or Not IsNull(Atteso(i)) Then
tmp = prob_weibull(Atteso(i), Atteso(i - 1), ParA, ParB)
If tmp < 0 Then Ret_value = Ret_value + (osserv(i) - tmp) ^ 2 / tmp
End If

and relative called procedure if wanted

Function prob_weibull(x2, x1, ParA, ParB As Double) As Double
With Application.WorksheetFunction
prob_weibull = .weibull(x2, ParA, ParB, True) - .weibull(x1, ParA, ParB,

True)
End With
End Function

Debugging the function step by step I noted that it crashes when the debug

window reports to me no
values for Atteso(5) (nor numeric neither null string "" ). What does it

mean? Is Atteso(5) null?
And why it passses the control "Not IsNull(Atteso(5))"?
Being more precise Atteso(5) refers to untouched cell (any kind of

formulas inside)

Which controls I must do to allow crashes to my code?

I hope is all well explained.

Thanks for all suggestions, Alex.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default other type values in array.

Hi Alex,

I agree with Tom's suggestion. And I have tried the IsEmpty funtion, it
will tell us if a excel cell is empty.
If you still have any concern on this issue, please feel free to post here.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

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
inputbox type 64 (array) pete the greek Excel Discussion (Misc queries) 8 May 20th 23 11:44 AM
INDEX function (array type) Sean[_3_] Excel Worksheet Functions 4 August 27th 09 10:06 PM
i need help with a lookup and/or array type formula RlzGain Excel Worksheet Functions 1 March 6th 06 07:47 PM
Looking for formula index/match-type that returns an array Tom Excel Worksheet Functions 1 April 1st 05 10:05 PM
Variant Array with String Values - Type Mismatch jamiee Excel Programming 2 March 7th 04 03:39 AM


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