ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value) (https://www.excelbanter.com/excel-programming/313536-textbox1-value%3Dtextbox2-value-textbox3-value-textbox4-value.html)

helmekki[_27_]

TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value)
 

i tried it but it did not work
i made a userform and placed textboxes on it and commandba
butten....but..... :confused:

could u hel

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=26909


TK

TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value)
 
Hi helmekki

You need to set texrbox1 to an integer.
You can either do this in code with the
line I added or right click the textbox and
set the value in the properties box.

Also; add another command button and
paste Dave's suggested code, it will work
with the same textboxes on the form.
You might want to change the format
to ###.00

Private Sub CommandButton1_Click()

Dim box1 As Integer
Dim box2 As Integer
Dim box3 As Integer
Dim box4 As Integer
box1 = TextBox1.Value
box2 = TextBox2.Value
box3 = TextBox3.Value
box4 = TextBox4.Value

'add this line or cut and paste
TextBox1.Value = 0

box1 = (box2 - (box3 + box4))

MsgBox box1, , "Good Luck TK"
TextBox1.Value = box1

End Sub

Good Luck
TK


"helmekki" wrote:


i tried it but it did not work
i made a userform and placed textboxes on it and commandbar
butten....but..... :confused:

could u help


--
helmekki


------------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=269094



Dave Peterson[_3_]

TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value)
 
I'm confused about what you tried and what you put in the textboxes when you
tried it.

You may want to post your code (and your data)--not the workbook.

helmekki wrote:

i tried it but it did not work
i made a userform and placed textboxes on it and commandbar
butten....but..... :confused:

could u help

--
helmekki

------------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=269094


--

Dave Peterson



All times are GMT +1. The time now is 12:22 AM.

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