Matt
You should put Option Explicit at the top of all of your modules (VBE -
Tools - Options - Require Variable Declaration)
That will tell you that
RushYdsStats = sngRushYards
has an undeclared variable. It should be RushingYdsStats.
--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.
"Matt V" wrote in message
...
I am use Excel 2k2 and when I run the code below it
returns a zero even though as I step through the process
and watch the varibles I get a number much greater then
zero.
Function RushingYdsStats(TeamName, YardsPerGame) As Single
Dim strDTeam As String
Dim b As Byte
Dim sngRushYards As Single
b = 2
Do While b < 18
strDTeam = WorksheetFunction.VLookup(TeamName,
Sheet3.Range("A2:R33"), b)
If strDTeam = "BYE" Then
b = b + 1
Else
sngRushYards = ((WorksheetFunction.VLookup
(strDTeam, Sheet1.Range("B3:Q34"), 3) + _
YardsPerGame) / 2) + sngRushYards
b = b + 1
End If
Loop
RushYdsStats = sngRushYards
End Function
Thanks for any assistance you can provide
Matt