Hi,
I would like to know how I can sum all of the Labes for Custo (lblCusto1 etc) and get the answer in the label total (lblTotal1).
Any help would be greatly appreicated.
Benedict
VBALooping.xlsm
Hi,
I would like to know how I can sum all of the Labes for Custo (lblCusto1 etc) and get the answer in the label total (lblTotal1).
Any help would be greatly appreicated.
Benedict
VBALooping.xlsm
Ben Van Johnson
Benedict,
Good evening and welcome to the forum. I'll beg your patience if I've misunderstood your question but when I call up your userform by clicking the "Add Item" button on Sheet "INGREDIENTS" and enter two different ingredients a total pops up in lblTotal1, highlighted in red. If you only enter one ingredient into the form no total shows up in lblTotal1 text box.
Were you hoping for the total to show up in red in the lblTotal1 cell?
Again, if I've misunderstood please clarify what you are looking for your code to do. Thanks.
Matthew
Benedict,
I checked out your other thread and it appears your question in that thread was answered so mark that thread as SOLVED by going to the Thread Tools drop down menu at the top of the thread. This way others won't see this as a "double post". As it looks to me, the question you've posted here is slightly different than in the other post, am I correct? Thanks.
Matthew
Dear Matthew,
Thanks. I am new to this. I have now marked it as SOLVED.
Won't happen again.
Many thanks,
Benedict
Matthew,
Do be honest I hadn't got that far yet.
At the moment what I would like to be able to do is fill in the ComboBox (ComboBox1) and the TextBox (tbQuantUsada1), and have the total show at the bottom of the userform.
I would like this action to automatically update as I enter more data into the userform.
Many thanks,
Benedict
Benedict,
I'm new around here too so no worries on not marking your post as SOLVED before. I've made plenty of missteps on the forum so far.
Now for this,
I've done exactly as you described above and after I enter the second ingredient into ComboBox2 and TextBox tbQuantUsada2 the sum of these two entries appears in red in the lblTotal1 TextBox. Try entering two or more ingredients and see what happens on your end.
Matthew
Benedict,
BTW, I noticed that when the cbAddRecord button was clicked on your userform, the code was throwing an error. I added a couple lines to your code and the error issues appears to be addressed:
![]()
Please Login or Register to view this content.
Thanks Matthew,
I guess what I am trying to find out is whether I can sum all of the labels within my userform, or whether I have to input code for every change event, such as:
And continuing going until lblCusto12HTML Code:
Benedict,
I now see what you are talking about. Are the following lines of code what you were hoping to avoid? Are you looking for a way to simplify the code? If so, I believe I've reach the limits of my ability to help. The following lines of code do what you are asking for but it definitely is not the most efficient way of accomplishing your goal.
![]()
Please Login or Register to view this content.
Last edited by moosetales; 05-18-2014 at 11:10 AM.
Matthew,
Thought that I'd let you know that I managed it!
I created a new sub, and then just called on that sub for every change event:
Then:HTML Code:
HTML Code:
Benedict,
Great. Glad your were able to solve your issue and thanks for sharing the solution.
Matthew
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks