ladeda16
04-05-2008, 08:27 PM
I was just wondering if i have followed the following criteria correctly
Create a function GetProducerRow() which takes in one String input (give it any name following the conventions) and returns an Integer.
Write a Select Case statement inside the function.
It should compare the input string with the various companies listed in the Voting tables in cells F5:F9.
The Case should not use hard coded values for the names of the companies but something like Range("F5").Value.
In each case, set the return value by assigning the appropriate row number. For example, the value assigned would be 5 for "The Hershey Company" store in F5.
Remember to write Case statement for each of the 5 producers.
Add the Case Else in-case none of the producers match the input and have the return value set to 0.
Function GetProducerRow(strProducer As String) As Integer
strProducer = Range("F5")
Select Case strProducer
Case Range("F5").Value
Range("G5").Value = 5
Case Range("F6").Value
Range("G6").Value = 4
Case Range("F7").Value
Range("G7").Value = 3
Case Range("F8").Value
Range("G8").Value = 4
Case Range("F9").Value
Range("G9").Value = 3
Case Else
Range("G5") = 0
End Select
End Function
Create a function GetProducerRow() which takes in one String input (give it any name following the conventions) and returns an Integer.
Write a Select Case statement inside the function.
It should compare the input string with the various companies listed in the Voting tables in cells F5:F9.
The Case should not use hard coded values for the names of the companies but something like Range("F5").Value.
In each case, set the return value by assigning the appropriate row number. For example, the value assigned would be 5 for "The Hershey Company" store in F5.
Remember to write Case statement for each of the 5 producers.
Add the Case Else in-case none of the producers match the input and have the return value set to 0.
Function GetProducerRow(strProducer As String) As Integer
strProducer = Range("F5")
Select Case strProducer
Case Range("F5").Value
Range("G5").Value = 5
Case Range("F6").Value
Range("G6").Value = 4
Case Range("F7").Value
Range("G7").Value = 3
Case Range("F8").Value
Range("G8").Value = 4
Case Range("F9").Value
Range("G9").Value = 3
Case Else
Range("G5") = 0
End Select
End Function