Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Textbox Question

Can someone help me with, I have textbox1 which has a number in it, I want
the user to type in the amount in textbox2 and I want textbox3 to show the
total of tb1 + tb2

How do I do this

Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Textbox Question


Hello Greg,

Here's the code...

Dim tbSum

tbSum = Val(TetxBox1.Value) + Val(TextBox2.Value)
TextBox3.Value = tbSum

Sincerely,
Leith Ross


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
baj baj is offline
external usenet poster
 
Posts: 24
Default Textbox Question

Hi,

When you design the userform it would also be a good idea to block the
(output)TextBox3 from any input with
Textbox3.Enabled = False

Then I would put a commandbutton on the screen which first makes a
control of the numeric values in the two (input)textboxes(1 & 2),
if this control is OK then the sum is shown in the outputbox Textbox3,
if it's not OK you get a message...

so I would adjust the code of Leith to this :

Private Sub CommandButton1_Click()

If IsNumeric(Val(TextBox2.Value)) And IsNumeric(Val(TextBox1.Value))
Then
TextBox3.Value = Val(TextBox2.Value) + Val(TextBox1.Value)
Else
MsgBox ("Not a Numeric value")
End If

End Sub


Bye
Baj

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox Question Patrick Simonds Excel Programming 2 September 29th 05 02:12 PM
Textbox question browie Excel Discussion (Misc queries) 0 June 13th 05 04:00 PM
Textbox question Jorge Rodrigues[_2_] Excel Programming 4 November 13th 04 11:08 PM
textbox question dok112[_22_] Excel Programming 1 August 10th 04 07:54 AM
Textbox question 2 Rich Cooper Excel Programming 5 June 14th 04 08:51 PM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"