Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Summing the values in text boxes


I am working with a user form that has three text boxes. The text boxe
are connected to three scroll bars. When the user adjusts the scrol
bars, the text box values change accordingly, or the user can manuall
enter a value into each box.

I would like to have a fourth text box that is a sum of the previou
three. I've tried a few things, but with no luck. As the user change
each box, the total in the fourth box should adjust accordingly.

Does anyone have any ideas on how to get this to work? I've trie
this...

txt4 = txt1.value + txt2.value + txt3.value

Thank

--
cosmic m
-----------------------------------------------------------------------
cosmic mo's Profile: http://www.excelforum.com/member.php...fo&userid=2090
View this thread: http://www.excelforum.com/showthread.php?threadid=52333

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Summing the values in text boxes

Generally speaking that should work, but you need to run that code when any
of the textboxes change... Another thing to try would be to convert the
values to numbers (text boxes hold text strings)...

txt4 = cdbl(txt1.value) + cdbl(txt2.value) + cdbl(txt3.value)

--
HTH...

Jim Thomlinson


"cosmic mo" wrote:


I am working with a user form that has three text boxes. The text boxes
are connected to three scroll bars. When the user adjusts the scroll
bars, the text box values change accordingly, or the user can manually
enter a value into each box.

I would like to have a fourth text box that is a sum of the previous
three. I've tried a few things, but with no luck. As the user changes
each box, the total in the fourth box should adjust accordingly.

Does anyone have any ideas on how to get this to work? I've tried
this...

txt4 = txt1.value + txt2.value + txt3.value

Thanks


--
cosmic mo
------------------------------------------------------------------------
cosmic mo's Profile: http://www.excelforum.com/member.php...o&userid=20900
View this thread: http://www.excelforum.com/showthread...hreadid=523339


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Summing the values in text boxes

Hi Cosmic mo

Could you teach me please how you setup the connection between a textbox and
a scroll bar such that when the user adjusts the scroll bar, the textbox
immediately changes - even before the user lifts their finger off the mouse.


Thanks

Phil


"cosmic mo" wrote:


I am working with a user form that has three text boxes. The text boxes
are connected to three scroll bars. When the user adjusts the scroll
bars, the text box values change accordingly, or the user can manually
enter a value into each box.

I would like to have a fourth text box that is a sum of the previous
three. I've tried a few things, but with no luck. As the user changes
each box, the total in the fourth box should adjust accordingly.

Does anyone have any ideas on how to get this to work? I've tried
this...

txt4 = txt1.value + txt2.value + txt3.value

Thanks


--
cosmic mo
------------------------------------------------------------------------
cosmic mo's Profile: http://www.excelforum.com/member.php...o&userid=20900
View this thread: http://www.excelforum.com/showthread...hreadid=523339


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Summing the values in text boxes


Hi Phil,

Here is the code I used for one scroll bar. There are two separate
subs I wrote for each scroll bar on my form.

This one will change the values when the user clicks the scroll bar
arrows, or clicks anywhere within the bar...

Private Sub scrCost_Change()
txtCost = scrCost / 100
End Sub

This one will change the value when the user drags the scroll bar...

Private Sub scrCost_Scroll()
txtCost = scrCost / 100
End Sub
The only difference is the _Change and the _Scroll portion.

Hopefully that helps.

Phil1982 Wrote:
Hi Cosmic mo

Could you teach me please how you setup the connection between a
textbox and
a scroll bar such that when the user adjusts the scroll bar, the
textbox
immediately changes - even before the user lifts their finger off the
mouse.


Thanks

Phil



--
cosmic mo
------------------------------------------------------------------------
cosmic mo's Profile: http://www.excelforum.com/member.php...o&userid=20900
View this thread: http://www.excelforum.com/showthread...hreadid=523339

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Summing the values in text boxes


Thanks for the suggestion, Jim. It turns out there was a separate erro
causing my problems.

I love it when that happens...

Morgan

Jim Thomlinson Wrote:
Generally speaking that should work, but you need to run that code whe
any
of the textboxes change... Another thing to try would be to conver
the
values to numbers (text boxes hold text strings)...

txt4 = cdbl(txt1.value) + cdbl(txt2.value) + cdbl(txt3.value)

--
HTH...

Jim Thomlinso


--
cosmic m
-----------------------------------------------------------------------
cosmic mo's Profile: http://www.excelforum.com/member.php...fo&userid=2090
View this thread: http://www.excelforum.com/showthread.php?threadid=52333

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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Data labels switch to text boxes on negative values Cooter Charts and Charting in Excel 3 May 1st 08 09:42 PM
Summing values in a range against specific text starguy Excel Discussion (Misc queries) 2 March 29th 06 06:30 AM
Setting Property Values of Text Boxes within Forms SkyEyes Excel Programming 1 July 1st 05 07:06 PM
How do you search values and display them in lables/text boxes mabz[_4_] Excel Programming 0 June 29th 04 11:52 AM


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

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

About Us

"It's about Microsoft Excel"