Hello Saziz,
Could you post your code so it it more clear what you want the code to do?
Thanks,
Leith Ross
Hello Saziz,
Could you post your code so it it more clear what you want the code to do?
Thanks,
Leith Ross
Hi Leith Ross,
here it is:
Private Sub CommandButton3_Click()
Dim lastrow As Object
Dim mysum As Variant
Set mysum = Sheet1.Range("g2")
Set lastrow = Sheet1.Range("a65536").End(xlUp)
lastrow.Offset(1, 0).Value = TextBox1.Text
lastrow.Offset(1, 1).Value = TextBox2.Text
lastrow.Offset(1, 2).Value = TextBox3.Text
lastrow.Offset(1, 3).Value = TextBox4.Text
lastrow.Offset(1, 5).Value = TextBox5.Text
lastrow.Offset(1, 4).Value = ComboBox1.Value
'MsgBox ("The total untill now is " & mysum)
End Sub
Originally I wanted it sum column G through code. Col. F has the $amount. All I want is to sum where ever is the last entry in Col. F Now what I did is dedicated a range (G2) for the total of the column F
I would still be interested in the systax.
Thank you
Syed
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
Leith
Thank you so much for the help.
syed
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks