Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add value from a single cell on the Userform

Status
Not open for further replies.

senators40

Technical User
Jan 7, 2003
68
CA
Hi,

I need to be able to insert an amount that appears in a single cell on a userform that will be next to a textbox.

What I am trying to do is this:

I have an amount (Part A). That Part A has to equal the amounts that the person is entering in the userform (ie Part B). I want to remind them of the total that they have to come up with.

ie The total expenditures for Part A is 100 and is found in cell A4 (an addition of cells A1 to A3)

Part A Part B
2003 2004
Total expenditures 100 textbox1 textbox2

I want to get the 100 from Part A (from Cell A4) and allow them to enter amounts in textbox1 and textbox2

Thanks in advance

Jeff
senators40@hotmail.com
 
You could automate it so that the total is automatically satisfied, e.g.

sub tb2003_exit
if isnumeric(tb2003) then
tb2004=sheets("data").range("A4")-val(tb2003)
end if
end sub

sub tb2004_exit
if isnumeric(tb2004) then
tb2003=sheets("data").range("A4")-val(tb2004)
end if
end sub

In other words, any time one of the textboxes is updated, the other one is changed to reflect the correct total (on sheet "data" in cell A4).
Rob
[flowerface]
 
Thanks for the response,

I actually want the 100 to be a static figure (does not change unless cell A4 changes). The "Part A" number was entered using another userform with more information. It should only be used for verification

At a later point I am going to give an error message if the numbers do not add up.

Thanks

Jeff
senators40@hotmail.com
 
I thank you for your response.

I was able to find a work around for this issue by using the ControlSource property - in the properties box next to the ControlSource I entered =A4 and the macro put what was in cell A4 into the textbox.

Unfortunately it does not allow for multiple additions (ie if I wanted to add cell A4 + A5 I would have to create the =sum(A4:A5) in cell A6 and then enter =A6 into the ControlSource Property.

If anyone can tell me how to include formulas and the result be put into a textbox I would appreciate it

Thanks

Jeff
senators40@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top