ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form Help needed (https://www.excelbanter.com/excel-programming/343705-form-help-needed.html)

saziz[_26_]

Form Help needed
 

Hi All,
I have a user form with several textboxes. One box has "$Amount".
what I am trying to do is when the user click the button after data
input, the total from the amount column should appear in dialog box.
What could be the script for this? The range will change each time an
entry is made.
Thank you for your help
Syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=478876


Leith Ross[_103_]

Form Help needed
 

Hello Saziz,

Could you post your code so it it more clear what you want the code t
do?

Thanks,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47887


saziz[_27_]

Form Help needed
 

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 th
$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
Sye

--
sazi
-----------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...nfo&userid=635
View this thread: http://www.excelforum.com/showthread.php?threadid=47887


Leith Ross[_108_]

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


saziz[_28_]

Form Help needed
 

Leith
Thank you so much for the help.
syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=478876



All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com