Changing text in a label on userform

Dave

New Member
Joined
Mar 13, 2002
Messages
25
Hi All:

I'm using userforms now (thanks everyone for the help and ideas:) and would like to have the text in a label (Label2) change as the user changes data on the form.

I.E.:
When the form opens, Label2 = "Welcome to my form".

After the user selects their name, Label2 = "Hello Dave, what would you like to do?"

I tried the following code to set the label text when the form opens:

Private Sub UserForm_Initialize()

Startup_Form.Label2.Caption = Worksheets("List").Range("A65").Value

End Sub

When this code fires I get "Runtime error 9: Subscript out of Range"

I'm using Rows A65-A75 (formated as text) to store data for the label.

Any thoughts on what I'm doing wrong, or is there a better way to do this?

Thanks

Dave
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
This text does not have to be put in a cell , it can be hard coded in the form like this:
Private Sub UserForm_Initialize()

Startup_Form.Label2.Caption = " Welcome to my Form"

Or you could type it directly into the Properties section of the Caption item for the object.

If how ever you want to put it in a cell check the address your using since the error your getting indicates it's not finding the information you want to enter.

End Sub
 
Upvote 0
Well, now I feel really stupid!! LOL

Worksheets("List").Range("A65").value
Should have been
Worksheets("Lists").Range("A65").value

I have been looking at and working on this monster WAAAAYYYY to long....

Thanks

Dave
 
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

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