I am Creating a Form to Track The Number Of Spaces in a Parking Lot. The End User would input whats ever was counted in the way of space then input that information in a TextBox. I have written the following code to handle the math portion of the program, the only problem is that I would have to write this code 265 times. the question is can this be done as a range of textboxes.
Code
Private Sub TextBox49_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox1.Value) - Val(TextBox25.Value)
TextBox49.Value = Total
End Sub
Private Sub TextBox50_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox2.Value) - Val(TextBox26.Value)
TextBox50.Value = Total
End Sub
Private Sub TextBox51_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox3.Value) - Val(TextBox27.Value)
TextBox51.Value = Total
End Sub
Private Sub TextBox52_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox4.Value) - Val(TextBox28.Value)
TextBox52.Value = Total
End Sub
Private Sub TextBox53_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox5.Value) - Val(TextBox29.Value)
TextBox53.Value = Total
End Sub
Private Sub TextBox54_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Total As Long
Total = Val(TextBox6.Value) - Val(TextBox30.Value)
TextBox54.Value = Total
End Sub
Display More