H
Heidi
I have created a button that when pushed, calculates a
weight based on a length that is entered. I need the
calculated weight that is displayed in the messege box at
the end to be rounded to two decimal places. How do I do
this? Here is the code I used:
Private Sub CalcHalibutWeight_Click()
Dim vntLength As Variant
'Obtain a length of the halibut from the user
vntLength = InputBox("Enter halibut length")
'Call the CalcWeight procedure; pass vntLength as argument
CalcWeight vntLength
End Sub
Sub CalcWeight(vntWeight As Variant)
'Calculate the weight of halibut based on length provided
vntWeight = 0.0003 * vntWeight ^ 3.0589
'Display the weight value calculated
MsgBox "Weight: " & vntWeight
End Sub
weight based on a length that is entered. I need the
calculated weight that is displayed in the messege box at
the end to be rounded to two decimal places. How do I do
this? Here is the code I used:
Private Sub CalcHalibutWeight_Click()
Dim vntLength As Variant
'Obtain a length of the halibut from the user
vntLength = InputBox("Enter halibut length")
'Call the CalcWeight procedure; pass vntLength as argument
CalcWeight vntLength
End Sub
Sub CalcWeight(vntWeight As Variant)
'Calculate the weight of halibut based on length provided
vntWeight = 0.0003 * vntWeight ^ 3.0589
'Display the weight value calculated
MsgBox "Weight: " & vntWeight
End Sub