autofill textbox based on other textbox entry

TimvanSprang

New Member
Joined
Feb 23, 2014
Messages
10
I think the solution is rather simple, I just can't find it.

I have textboxes 102, 103, 104, 105, 106

I want the values in 103-106 to be autofilled based on values in 102. I wrote the following code.

Private Sub TextBox102_change()
TextBox103.Value = TextBox102.Value * 3.125
TextBox104.Value = TextBox103.Value * 2
TextBox105.Value = TextBox102.Value * 0.2
TextBox106.Value = TextBox104.Value * 2

This works perfectly untill I use backspace in textbox102. as soon as the value in textbox 102 is removed an error occurs.

error 13
type doesn't mach (or something like that, I had to translate from dutch)

Can someone help me fix this problem?

Thanks a lot
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Have you tried assigning the values to variables first, as intermediate steps, before those in turn are assigned to the respective boxes?
 
Upvote 0
sTB103 = TextBox102.Value * 3.125: TextBox103.Value = sTB103
sTB104 =TextBox103.Value * 2: TextBox104.Value = sTB104
sTB105 = TextBox102.Value * 0.2: TextBox105.Value = sTB105
sTB106 = TextBox104.Value * 2: TextBox106.Value = sTB106
 
Upvote 0
Nope,

that doesn't work. The problem I think is caused by the formula's. At the beginning there is nothing in textbox 103. But as soon as I change textbox102 textbox103 startscalculating and causes an error when textbox102 is emptyd. But I can;t figure out how to fix it.
 
Upvote 0
Try connecting each TextBox to its own individual spreadsheet cell, then operate on the latter. Refresh if necessary.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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