Hi, I have a problem with the autosum function not updating.
I have data such as:
a 1
b 2
c 3
total 6 (this uses the autosum)
I have a form which allows the user to insert data before the total.
So if the user inserted d 4 then this is the result:
a 1
b 2
c 3
d 4
total 10
At the moment i can insert data but the autosum doesnt update so in the example above the total would stay at 6, an error does appear tell me to
"update formula to include cells", what i want to know is how to do this automatically ie i dont want the user to have to do this.
PS my code for when the user click on the add button on my form is:
I have data such as:
a 1
b 2
c 3
total 6 (this uses the autosum)
I have a form which allows the user to insert data before the total.
So if the user inserted d 4 then this is the result:
a 1
b 2
c 3
d 4
total 10
At the moment i can insert data but the autosum doesnt update so in the example above the total would stay at 6, an error does appear tell me to
"update formula to include cells", what i want to know is how to do this automatically ie i dont want the user to have to do this.
PS my code for when the user click on the add button on my form is:
Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Set r = Cells(Rows.Count, "A").End(xlUp)
r.Offset(-3, 0).EntireRow.Insert
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(-4, 0).Row
ws.Cells(iRow, 1).Value = Me.TextBox1.Value
ws.Cells(iRow, 2).Value = Me.TextBox2.Value
Unload UserForm1
End Sub