View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_108_] Leith Ross[_108_] is offline
external usenet poster
 
Posts: 1
Default Form Help needed


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".



Code:
--------------------
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

--------------------


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=478876