Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
[b][red]This message was edited by the Moderator at 2002-4-1 16:52:55[/red][/b][hr]
I'm having difficulty with the Format function. I have created some code to figure the averages of a set of inputs. When I type my code, I want the numbers to be in the format "0.00" but if the average ends up being a whole number (integer), the code will not force it to be followed by .00. In other words, if I want to get 480.00, I am only getting 480 with no decimal point or zeros. Here is my code, please help if you can. Thanks!
'create a loop to display the averages _
'of each score (verbal, quantitative, _
'and analytical) for all entered students
Dim a As Integer
For a = 1 To UBound(fStudents)
VAverage = (VAverage + fStudents(a).VScore / StudentIndex)
QAverage = (QAverage + fStudents(a).QScore / StudentIndex)
AAverage = (AAverage + fStudents(a).AScore / StudentIndex)
'display averages in the format "0.00"
'round averages up to the next 1/100th (.00)
VAverage = Format(Round(VAverage, 2), "0.00")
QAverage = Format(Round(QAverage, 2), "0.00")
AAverage = Format(Round(AAverage, 2), "0.00")
0 · ·