Quick way to add the value in many textboxes in a userform

birdieman

Well-known Member
Joined
Jan 13, 2016
Messages
551
I have a userform in which I need to add the values in about 25 textboxes (there are formatted numbers in the boxes, like $5,000). Is there a quick and easy way to do it without adding one by one (TextBox50 + TextBox52, etc.)? If it helps, the names/labels are all TextBoxXX (XX is a number) and all TextBox numbers are EVEN numbers between 50 and 100. Thanks
 
Last edited:

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,216
Office Version
  1. 365
Platform
  1. Windows
Do you want to add all of the textboxes or is it pairs of textboxes?

Where should the result(s) go?
 

birdieman

Well-known Member
Joined
Jan 13, 2016
Messages
551
I want to add the values in all EVEN textboxes from say Textbox150 to TextBox198 (Textbox 150+ textbox 152 + textbox 154....+TextBox198) and put result in Textbox200
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,216
Office Version
  1. 365
Platform
  1. Windows
Are they all formatted the same?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,216
Office Version
  1. 365
Platform
  1. Windows
Note I'm asking about formatting because we need to convert the text in the textboxes to numeric to add the values, looping through the textboxes is the easy part.

For example to loop through every even textbox from 150 to 198 we can use this.
Code:
For I = 150 To 198 Step 2
    MsgBox Me.Controls("Textbox" & I).Value
Next I
 

birdieman

Well-known Member
Joined
Jan 13, 2016
Messages
551
yes, all are formatted "$##,##0". Some may not be that long but all are $#.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,368
Messages
5,595,755
Members
414,017
Latest member
surajks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top