Userform Textbox vs Label

Hjemmet

Board Regular
Joined
Jun 20, 2018
Messages
203
I got this code

Code:
Private Sub Label1_Click()
Label1.Caption = Worksheets("Ark1").Range("B1")


End Sub


Private Sub Label2_Click()
Label2.Caption = Worksheets("Ark1").Range("B2")


End Sub


Private Sub TextBox1_Change()
Worksheets("Ark1").Range("B1").Value = TextBox1.Value


End Sub


Private Sub TextBox2_Change()
Worksheets("Ark1").Range("B2") = TextBox2.Value


End Sub
On my userform BUt they are NOT showing anything before i click on Both Label and Textbox
i want it to show right away when Userform Start up

and by the way How will i Get Commandbutton to close userform

i have Try this function " Hide Me" - "Unload Me" Userform Hide" and none of them Work
 
Last edited by a moderator:

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.
You need this script in your Userform to update the label names when Userform is opened.
Now how do you expect the two textboxes to update a sheet when the Userform is Opened?
The Two textbox's will be empty when you open the Userform.

And this button you have to close the Userform. Is this button on the Userform?

If it's on the Userform.

Unload Me should work.

Do not put quotes around Unload Me

Code:
Private Sub UserForm_Initialize()
'Modified  10/2/2018  9:31:19 PM  EDT
Label1.Caption = Worksheets("Ark1").Range("B1").Value
Label2.Caption = Worksheets("Ark1").Range("B2").Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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