Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple function

Status
Not open for further replies.

sabascal

IS-IT--Management
Aug 20, 2002
85
0
0
GB
Hi all,

The here below custom function should return me the non integer. I got the compile error: Next without for
I don't understand why.

Can somebody help.

Thanks Seb.


=====================
Function StartDep() As Double
a = 0
For i = 1 To 10
YrStart = Range("flag1").Cells(1, i)
If YrStart > 0 Then
a = YrStart
Exit function

Next i
StartDep = a

End Function
 
Because you have actually have an error in a block If statement. Put an End If after your Exit Function statement, and all should be well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top