getting totals from textboxes

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
140
Office Version
  1. 365
  2. 2019
Ok, not so sure why this is harder than it seem but noting is working. I have been all over this BB and others and nothing works
I have tried copying just adding the values. I have tried declaring variables I have tried something with LEN in it and several other
things I can think of but nothing is putting the totals of my text boxes in the answer box.

Everything I've read wants me to put it in the Private Sub UserForm_Initialize() but I'm not sure that will work because I have values changing
after the form has been loaded.

I have a user form and there is 7 boxes where values get brought into by clicking on
a name in a dropdown box. Each new name brings a seperate set of values.
The text boxes are YTDQ3, YTDQ4, YTDQ5, YTDQ6, YTDQ7, YTDQ8, YTDQ9.
The next box populates with the value 65
the totals box "YTDOKCscores" should take the values that show up in Q3 through Q9
add them together then divide by the 65 "YTD65"
I need YTDOKCScores to change each time Q9 changes so I have been trying to code it in
the change event for YTDQ9
All boxes are formatted like this YTDQ3 = Format(YTDQ3, "#0.00") and is working
I've just completely run out of ideas.
Any help would be greatly appreciated.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
This script will run when you Exit textbox named:
YTDQ9

This must be run when you exit the textbox. Otherwise it will run when you enter the first character.
So if you wanted to enter 45 the script would run when you entered the 4 before you entered the 5

But now if all the values are being entered do to a Combobox value change it would work on change.

Maybe you would like to share the script that puts the values into the textboxes from the Combobox you mentioned. I use the term Combobox not Drop Down

Put this script in the Textbox named
YTDQ9
Code:
Private Sub YTDQ9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Long
Dim ans As Long
ans = 0
    For i = 3 To 9
    ans = Controls("YTDQ" & i).Value + ans
    Next
    YTDOKCscores.Value = ans / YTD65
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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