Assign name to label in user form

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,600
Office Version
  1. 365
Platform
  1. Windows
I have a label in a user form and I want to assign a text value to it dependant on a cells value.

E.g.
Cell A6 = "Manager"
User Form Label = "Manager"


Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try

Code:
Private Sub UserForm_Initialize()
Me.Label1.Caption = Sheets("Sheet1").Range("A6").Value
End Sub
 
Upvote 0
The label will change as the routine looks at a list and needs to change it a few times.

Is there a way of doing it without having to re initialise the form every time?
 
Upvote 0
You don't have to use the Initialize code.

Code:
Sub test()
Sheets("Sheet1").Range("A6").Value = "Another"
UserForm1.Label1.Caption = Sheets("Sheet1").Range("A6").Value
UserForm1.Show
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

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