In userform, want to sum up to value from textbox7 to texbox 70.

minmark

New Member
Joined
Jul 18, 2016
Messages
44
<embed id="xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd" type="application/thunder_download_plugin" height="0" width="0">Dear Gents,

I would like to add the value (sum) from textbox 7 to text box 70.
my plan is make a button to sum up these value...
activecell.value= TextBox7.value + TextBox8.value +........ +TextBox70.Value

Is there any way to express them through loop or sth?
I can't figure out the code...
I stuck in the setup of variable.....
please help..... thanks.
for i = 7 to 70


next i
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Code:
Dim i As Long
Dim mySum as Double

For i = 7 to 70
    mySum = mySum + Val(Me.Controls("TextBox" & i).Text)
Next i
 
Last edited:
Upvote 0
Dear Sir,

Thanks for your reply in time.:bow::bow: It operate smoothly.~~
is Val() means value
Controls means those object in the Me?

Thanks.~~~

Code:
Dim i As Long
Dim mySum as Double

For i = 7 to 70
    mySum = mySum + Val(Me.Controls("TextBox" & i).Text)
Next i

<embed id="xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd" type="application/thunder_download_plugin" height="0" width="0">
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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
Back
Top