S
SkippyPB
I had posted earlier some formulas I am trying to reduce to functions
and didn't get any response. I guess it was too hard or maybe can't
be done.
Anyway, I'm taking a small piece of it and trying things on my own. In
a cell I have the following function:
=QBRushYds(1, 1)
The first argument is week number corresponding to a sheet name and
the second arguement is the position of the player corresponding to a
cell on the sheet. The function returns an error (#Value):
Here is the function definition:
Public Function QBRushYds(W, Q)
' Calculates Points for Rushing Yards by a QB
'
Dim Yds As Integer
Select Case W
Case 1: Sheets("Week1").Activate
Case 2: Sheets("Week2").Activate
Case 3: Sheets("Week3").Activate
Case 4: Sheets("Week4").Activate
Case 5: Sheets("Week5").Activate
Case 6: Sheets("Week6").Activate
Case 7: Sheets("Week7").Activate
Case 8: Sheets("Week8").Activate
Case 9: Sheets("Week9").Activate
Case 10: Sheets("Week10").Activate
Case 11: Sheets("Week11").Activate
Case 12: Sheets("Week12").Activate
Case 13: Sheets("Week13").Activate
Case 14: Sheets("Week14").Activate
Case 15: Sheets("Week15").Activate
Case 16: Sheets("Week16").Activate
Case Else: Sheets("Week17").Activate
End Select
Select Case Q
Case 1: ActiveSheet.Range("C3").Select
Case 2: ActiveSheet.Range("C4").Select
Case 3: ActiveSheet.Range("C5").Select
Case 4: ActiveSheet.Range("C6").Select
End Select
Yds = cell.Value
QBRushYds = 0
QBRushYds = Yds / 10
End Function
What's the problem?
Thanks.
////
(o o)
-oOO--(_)--OOo-
Two boll weevils grew up in South Carolina.
One went to Hollywood and became a famous actor.
The other stayed behind in the cotton fields and never amounted to much.
The second one, naturally, became known as the lesser of two weevils.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove nospam to email me.
Steve
and didn't get any response. I guess it was too hard or maybe can't
be done.
Anyway, I'm taking a small piece of it and trying things on my own. In
a cell I have the following function:
=QBRushYds(1, 1)
The first argument is week number corresponding to a sheet name and
the second arguement is the position of the player corresponding to a
cell on the sheet. The function returns an error (#Value):
Here is the function definition:
Public Function QBRushYds(W, Q)
' Calculates Points for Rushing Yards by a QB
'
Dim Yds As Integer
Select Case W
Case 1: Sheets("Week1").Activate
Case 2: Sheets("Week2").Activate
Case 3: Sheets("Week3").Activate
Case 4: Sheets("Week4").Activate
Case 5: Sheets("Week5").Activate
Case 6: Sheets("Week6").Activate
Case 7: Sheets("Week7").Activate
Case 8: Sheets("Week8").Activate
Case 9: Sheets("Week9").Activate
Case 10: Sheets("Week10").Activate
Case 11: Sheets("Week11").Activate
Case 12: Sheets("Week12").Activate
Case 13: Sheets("Week13").Activate
Case 14: Sheets("Week14").Activate
Case 15: Sheets("Week15").Activate
Case 16: Sheets("Week16").Activate
Case Else: Sheets("Week17").Activate
End Select
Select Case Q
Case 1: ActiveSheet.Range("C3").Select
Case 2: ActiveSheet.Range("C4").Select
Case 3: ActiveSheet.Range("C5").Select
Case 4: ActiveSheet.Range("C6").Select
End Select
Yds = cell.Value
QBRushYds = 0
QBRushYds = Yds / 10
End Function
What's the problem?
Thanks.
////
(o o)
-oOO--(_)--OOo-
Two boll weevils grew up in South Carolina.
One went to Hollywood and became a famous actor.
The other stayed behind in the cotton fields and never amounted to much.
The second one, naturally, became known as the lesser of two weevils.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove nospam to email me.
Steve