Userform Textbox with figures

Doflamingo

Board Regular
Joined
Apr 16, 2019
Messages
238
Hi all,

I have a userform with some textboxs that are linked to some cells in a sheet of Excel.

Here is the code of the userform

Private Sub UserForm_Initialize()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""

end sub

And here is the code of the command button which is supposed to put in some specific cells of Excel, the values of the figures put in the textboxes

Private Sub CommandButton1_Click()
Sheet1.Activate
Range("B4") = TextBox1.Value = ""
Range("c4") = TextBox2.Value = ""
Range("d4") = TextBox3.Value = ""
Range("e4") = TextBox4.Value = ""


End Sub

But that's weird, because when I enter the values of figures in the different textboxes and then click on the commandbutton, I see in ranges b4, c4, d4, e4 : FALSE

Any ideas ? :confused:

I would rather like to see the figures entered in the textboxes.

Many thanks in advance
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Remove this part
Code:
= ""
from all those lines
 
Upvote 0
Thank you Fluff, works perfectly, I would outline that point: remove ="" only for the commandbutton but nor for the userform.

Thanks again!!

Have a good day :)
 
Upvote 0
If you unload the Userform when you close it all those Textboxes are cleared automatically.

Close UserForm like this:

Unload Me
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,399
Members
449,447
Latest member
M V Arun

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