LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Textbox adding problem

Hey Rob, this is your code

I have 22 Product Types. You select the product from the ComboBox. When
you select the product, all the textboxes auto populate. Each product has 3
textboxes. One is Number of Units, next is Unit Cost, next is Unit Sale.
Every product has these textboxes and these 3 text boxes have direct impact
over profit. In each of these 3 textbox change events I put the code
CalculateProfit so it will call that procedure from the module. The module
contains this code below. My problem is when I select multiple products,
textbox 119 does not add the textboxes up, it just keeps adding the price
into the textbox. For example, one product I select has a profit of $30,
the next has a profit of $40, instead of textbox 119 displaying $80, it
displays $30$40. This pattern continues. Why is this happening? Is it
happening because the code is in the change event for each product so the
code calculates it up individual? I would like for it to add it so $80
displays.

Sub CalculateProfit()
Dim strTemp as String

strTemp = OrderForm.TextBox9.Value + OrderForm.TextBox14.Value +
OrderForm.TextBox19.Value + OrderForm.TextBox24.Value + _
OrderForm.TextBox29.Value + OrderForm.TextBox34.Value +
OrderForm.TextBox39.Value + OrderForm.TextBox44.Value + _
OrderForm.TextBox49.Value + OrderForm.TextBox54.Value +
OrderForm.TextBox59.Value + OrderForm.TextBox64.Value + _
OrderForm.TextBox69.Value + OrderForm.TextBox74.Value +
OrderForm.TextBox79.Value + OrderForm.TextBox84.Value + _
OrderForm.TextBox89.Value + OrderForm.TextBox94.Value +
OrderForm.TextBox99.Value + OrderForm.TextBox104.Value + _
OrderForm.TextBox109.Value + OrderForm.TextBox114.Value

OrderForm.TextBox119.Value = Replace(strTemp, "Select", "")
End Sub


 
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
Problem with TAB key and Textbox controls Paul M[_4_] Excel Programming 2 June 6th 14 05:54 PM
Dynamically Adding Textbox To Frame sarndt Excel Worksheet Functions 0 March 15th 10 06:19 PM
Problem with TextBox & ControlSource - Please Help [email protected] Excel Programming 8 January 14th 04 06:45 AM
TextBox SetFocus Problem Tom Ogilvy Excel Programming 1 September 12th 03 01:27 PM
Excel textbox problem numcrun Excel Programming 0 July 16th 03 10:05 AM


All times are GMT +1. The time now is 07:16 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"