I have multiple checkboxes (1 to 8) in Userform (VBA) and their values are mentioned in Ride.Caption (1 to 8). If I check any checkbox, then its value mentioned in Ride should add in Total Value and If I uncheck any checkbox then the value should deduct from the Total Value
As per the below code, I have added all values in Total. But, Checkbox coding is still pending, and I do not know how I can make this code complete. Help me out with your expertise.
Private Sub TotalValue_Click()
Dim X As Double
X = 0
If Len(Ride1.Caption) > 0 Then X = X + Ride1.Caption
If Len(Ride2.Caption) > 0 Then X = X + Ride2.Caption
If Len(Ride3.Caption) > 0 Then X = X + Ride3.Caption
If Len(Ride4.Caption) > 0 Then X = X + Ride4.Caption
If Len(Ride5.Caption) > 0 Then X = X + Ride5.Caption
If Len(Ride6.Caption) > 0 Then X = X + Ride6.Caption
If Len(Ride7.Caption) > 0 Then X = X + Ride7.Caption
If Len(Ride8.Caption) > 0 Then X = X + Ride8.Caption
TotalValue.Caption = X
End Sub
Aucun commentaire:
Enregistrer un commentaire