Hi - I have an Excel 2003 version worksheet where I'm tracking the number of items ordered (e.g. magazine orders).
I've created 2 Checkboxes and 3 Textboxes (from the Control Toolbox toolbar). The 1st Textbox adds the number of times the 1st Checkbox is clicked and subtracts out if 1st Checkbox is deselected by the user. The 2nd Textbox does the same thing coordinated with the 2nd Checkbox.
The 3rd Textbox is doing an on-going grand total of the clicks in the 1st and 2nd Checkboxes. The code I've created for these Check & Text boxes seems to be working fine.
However, what I can't get to work is to have both Checkboxes and the first 2 Textboxes automatically clear out BUT have the on-going value in the 3rd Textbox retain its value, and I want this action to occur when the Workbook IS CLOSED, and have the workbook automatically save itself, too.
Here is the code I've been playing with but won't work. WHAT AM I DOING WRONG? Thank you.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Box1Retain As Integer
Box1Retain = TextBox1.Text
Dim Box2Retain As Integer
Box2Retain = TextBox2.Text
CheckBox1 = False
CheckBox2 = False
TextBox1.Text = Box1Retain
TextBox2.Text = Box2Retain
Dim Box3Retain As Integer
Box3Retain = Box1Retain + Box2Retain
TextBox3.Text = Box3Retain
ActiveWorkbook.Save
End Sub