0% found this document useful (0 votes)
20 views

Code For PPT Vba TextBoxesSum

The document contains code that clears the text from 20 text boxes when a slideshow terminates. It also contains 4 separate sections that calculate a running total and display it in a text box when the values in 4 corresponding text boxes change. Each section sums the values in its 4 text boxes and assigns the total to a 5th text box.

Uploaded by

KeTuong Tran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Code For PPT Vba TextBoxesSum

The document contains code that clears the text from 20 text boxes when a slideshow terminates. It also contains 4 separate sections that calculate a running total and display it in a text box when the values in 4 corresponding text boxes change. Each section sums the values in its 4 text boxes and assigns the total to a 5th text box.

Uploaded by

KeTuong Tran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Sub OnSlideShowTerminate()

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

TextBox5.Text = ""

TextBox6.Text = ""

TextBox7.Text = ""

TextBox8.Text = ""

TextBox9.Text = ""

TextBox10.Text = ""

TextBox11.Text = ""

TextBox12.Text = ""

TextBox13.Text = ""

TextBox14.Text = ""

TextBox15.Text = ""

TextBox16.Text = ""

TextBox17.Text = ""

TextBox18.Text = ""

TextBox19.Text = ""

TextBox20.Text = ""

End Sub

Private Sub TextBoxesSum1()

Dim Total As Double

Total = 0

If Len(TextBox1.value) > 0# Then Total = Total + CDbl(TextBox1.value)

If Len(TextBox2.value) > 0# Then Total = Total + CDbl(TextBox2.value)

If Len(TextBox3.value) > 0# Then Total = Total + CDbl(TextBox3.value)


If Len(TextBox4.value) > 0# Then Total = Total + CDbl(TextBox4.value)

TextBox5.value = Total

End Sub

Private Sub TextBox1_Change()

TextBoxesSum1

End Sub

Private Sub TextBox2_Change()

TextBoxesSum1

End Sub

Private Sub TextBox3_Change()

TextBoxesSum1

End Sub

Private Sub TextBox4_Change()

TextBoxesSum1

End Sub

Private Sub TextBoxesSum2()

Dim Total As Double

Total = 0

If Len(TextBox6.value) > 0# Then Total = Total + CDbl(TextBox6.value)

If Len(TextBox7.value) > 0# Then Total = Total + CDbl(TextBox7.value)

If Len(TextBox8.value) > 0# Then Total = Total + CDbl(TextBox8.value)

If Len(TextBox9.value) > 0# Then Total = Total + CDbl(TextBox9.value)

TextBox10.value = Total

End Sub

Private Sub TextBox5_Change()

End Sub

Private Sub TextBox6_Change()


TextBoxesSum2

End Sub

Private Sub TextBox7_Change()

TextBoxesSum2

End Sub

Private Sub TextBox8_Change()

TextBoxesSum2

End Sub

Private Sub TextBox9_Change()

TextBoxesSum2

End Sub

Private Sub TextBoxesSum3()

Dim Total As Double

Total = 0

If Len(TextBox11.value) > 0# Then Total = Total + CDbl(TextBox11.value)

If Len(TextBox12.value) > 0# Then Total = Total + CDbl(TextBox12.value)

If Len(TextBox13.value) > 0# Then Total = Total + CDbl(TextBox13.value)

If Len(TextBox14.value) > 0# Then Total = Total + CDbl(TextBox14.value)

TextBox15.value = Total

End Sub

Private Sub TextBox11_Change()

TextBoxesSum3

End Sub

Private Sub TextBox12_Change()

TextBoxesSum3

End Sub

Private Sub TextBox13_Change()

TextBoxesSum3
End Sub

Private Sub TextBox14_Change()

TextBoxesSum3

End Sub

Private Sub TextBoxesSum4()

Dim Total As Double

Total = 0

If Len(TextBox16.value) > 0# Then Total = Total + CDbl(TextBox16.value)

If Len(TextBox17.value) > 0# Then Total = Total + CDbl(TextBox17.value)

If Len(TextBox18.value) > 0# Then Total = Total + CDbl(TextBox18.value)

If Len(TextBox19.value) > 0# Then Total = Total + CDbl(TextBox19.value)

TextBox20.value = Total

End Sub

Private Sub TextBox16_Change()

TextBoxesSum4

End Sub

Private Sub TextBox17_Change()

TextBoxesSum4

End Sub

Private Sub TextBox18_Change()

TextBoxesSum4

End Sub

Private Sub TextBox19_Change()

TextBoxesSum4

End Sub

You might also like