LeeSmith
Registered User.
- Local time
- Today, 21:10
- Joined
- Mar 17, 2006
- Messages
- 27
Hi. Apologies if this question has been posted before, but I couldn't find it when I searched.
I'm trying to populate 4 fields with percentage amounts when a button is pressed. It appears to work fine when done as a number, but when I change the format of the 4 result fields to percentage it just shows zero for all. Below in italics is an example of my code.
Private Sub cmdEnd_Click()
On Error GoTo Err_cmdEnd_Click
ResultOne = NumberOne / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultTwo = NumberTwo / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultThree = NumberThree / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultFour = NumberFour / (NumberOne + NumberTwo + NumberThree + NumberFour)
Exit_cmdEnd_Click:
Exit Sub
Err_cmdEnd_Click:
MsgBox Err.Description
Resume Exit_cmdEnd_Click
End Sub
Any help with this would be appreciated.
I'm trying to populate 4 fields with percentage amounts when a button is pressed. It appears to work fine when done as a number, but when I change the format of the 4 result fields to percentage it just shows zero for all. Below in italics is an example of my code.
Private Sub cmdEnd_Click()
On Error GoTo Err_cmdEnd_Click
ResultOne = NumberOne / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultTwo = NumberTwo / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultThree = NumberThree / (NumberOne + NumberTwo + NumberThree + NumberFour)
ResultFour = NumberFour / (NumberOne + NumberTwo + NumberThree + NumberFour)
Exit_cmdEnd_Click:
Exit Sub
Err_cmdEnd_Click:
MsgBox Err.Description
Resume Exit_cmdEnd_Click
End Sub
Any help with this would be appreciated.