Hello Syed,
This will sum columns "F" through "I" on the last line entered on the worksheet with the values of the TextBox and CombBox then place the sum in cell "G2".
Private Sub CommandButton3_Click()
Dim lastrow As Long
Dim mysum As Variant
Set mysum = Sheet1.Range("G2")
Set lastrow = Sheet1.Range("A65536").End(xlUp)
With Sheet1.Cells(lastrow, "F")
MySum = MySum + .Offset(0, 0).Value = TextBox1.Text
MySum = MySum + .Offset(0, 1).Value = TextBox2.Text
MySum = MySum + .Offset(0, 2).Value = TextBox3.Text
MySum = MySum + .Offset(0, 3).Value = TextBox4.Text
MySum = MySum + ComboBox1.Value
MySum = MySum + TextBox5.Text
End with
MsgBox ("The total untill now is " & mysum)
End Sub
Bookmarks