Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default 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
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
IF function returns function statement rather than result ckrogers Excel Worksheet Functions 3 April 16th 09 09:21 PM
=Large function returns #NUM! Bryan Gnidrah Excel Worksheet Functions 5 February 17th 09 08:05 PM
Function returns a list Rana Excel Worksheet Functions 2 July 2nd 07 05:02 PM
INT Function Returns 1 bhavesh Excel Worksheet Functions 3 December 29th 06 02:48 PM
Date function returns #NUM! [email protected] Excel Worksheet Functions 5 May 10th 06 06:15 PM


All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"