Thank you very much stickleprojects. However, I can't make it work. Probably, the problem is in my Excel. The if .. then .. else statement does not work properly. You have any recommendation?
19-10-2005 at 02:52 PM
|
stickleprojects Level: Moderator Registered: 09-09-2002 Posts: 891
Re: just so simple but can't figure out
Hi,
Can you bit more specific about not working properly please?
Kieron
____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)
hello stickleprojects,
even from your code (delete one t from ttest --> test.rows), I get the result as #VALUE. I assume it is a problem of MS Excel in my computer. Other than that, I don't find any reasons because it is a very simple function. All other functions that I use with if...then ...else do not work properly. You have any other suggestion?
19-10-2005 at 06:07 PM
|
stickleprojects Level: Moderator Registered: 09-09-2002 Posts: 891
Re: just so simple but can't figure out
HI,
#value means that excel doesn't understand the return value.
Are all values in your range numbers?
Apologies.. typo-s all-over the place.
Corrected Code:
Function tt(test As Range) As Integer
Dim r As Range
tt = 1
For Each r In test.Rows
If r.Cells(1, 1).Value = 0 Then
tt = 0
Exit For
Else
tt = 1
End If
Next r
End Function
____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)