Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function returns a zero value
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF function returns function statement rather than result | Excel Worksheet Functions | |||
=Large function returns #NUM! | Excel Worksheet Functions | |||
Function returns a list | Excel Worksheet Functions | |||
INT Function Returns 1 | Excel Worksheet Functions | |||
Date function returns #NUM! | Excel Worksheet Functions |