BACKGROUND:
I have been working on a complicated workbook for about a week now that charts multiple variables from daily feedback forms over time. I integrated vba forms into the spreadsheets to mimic the hard copy forms that would be used for input. Everything works fine except for when it comes to calculating totals from text boxes.
PROBLEM:
I currently have the form adding the values and returning a total. This means that if a value is miskeyed and the user corrects it in the spreadsheet, the total does not update as it is not dependent on the data from the cells, only on the data entered from the form.
The effect I am looking to achieve would be akin to pasting the formula for total into the proper cell when clicking the OK button on the form.
CONSTRAINTS:
-The user must be able to change a cell in the worksheet and have the total update
-You may not copy the formula sum=() into the cells (would cause conflict with form output)
OTHER:
The code that is currently checking for columns and totaling numbers follows the format:
(The very last line is where the total is calculated).
I have been working on a complicated workbook for about a week now that charts multiple variables from daily feedback forms over time. I integrated vba forms into the spreadsheets to mimic the hard copy forms that would be used for input. Everything works fine except for when it comes to calculating totals from text boxes.
PROBLEM:
I currently have the form adding the values and returning a total. This means that if a value is miskeyed and the user corrects it in the spreadsheet, the total does not update as it is not dependent on the data from the cells, only on the data entered from the form.
The effect I am looking to achieve would be akin to pasting the formula for total into the proper cell when clicking the OK button on the form.
CONSTRAINTS:
-The user must be able to change a cell in the worksheet and have the total update
-You may not copy the formula sum=() into the cells (would cause conflict with form output)
OTHER:
The code that is currently checking for columns and totaling numbers follows the format:
(The very last line is where the total is calculated).
Code:
ColumnCount = Worksheets("DAILY DEFECT LOG").Range("A1").CurrentRegion.Columns.Count
With Worksheets("DAILY DEFECT LOG").Range("A1")
.Offset(0, ColumnCount).Value = DateValue(Me.txtDate.Value)
.Offset(1, ColumnCount).Value = Me.cmbFloater.Value
.Offset(2, ColumnCount).Value = Me.cmbLead.Value
.Offset(3, ColumnCount).Value = Me.cmbM1.Value
.Offset(4, ColumnCount).Value = Me.cmbM1Model.Value
.Offset(5, ColumnCount).Value = Me.cmbM1Model2.Value
.Offset(6, ColumnCount).Value = Me.cmbM1Printer.Value
.Offset(7, ColumnCount).Value = Me.cmbM1Loader.Value
.Offset(8, ColumnCount).Value = Me.txtM1Paint.Value
.Offset(9, ColumnCount).Value = Me.txtM1Machine.Value
.Offset(10, ColumnCount).Value = Me.txtM1OpPr.Value
.Offset(11, ColumnCount).Value = Me.txtM1OpLd.Value
Dim v1 As Integer
Dim v2 As Integer
Dim v3 As Integer
Dim v4 As Integer
v1 = Me.txtM1Paint.Value
v2 = Me.txtM1Machine.Value
v3 = Me.txtM1OpPr.Value
v4 = Me.txtM1OpLd.Value
.Offset(12, ColumnCount).Value = v1 + v2 + v3 + v4
Last edited by a moderator: