Hello,
I'm trying to change the text in a label called NameLabel1 with the code NameLabel1.Caption = "hello"
However it fails with the message "object required".
How does one change the text properly?
/Johan
Hello,
I'm trying to change the text in a label called NameLabel1 with the code NameLabel1.Caption = "hello"
However it fails with the message "object required".
How does one change the text properly?
/Johan
Johan
That is the correct code to set the caption of a Label.
Where is the label located and where is the code located?
If posting code please use code tags, see here.
Can we assume the label is on the worksheet rather than a userform?
Is the label from the Forms or ActiveX set of controls?
If the label is situated on a worksheet the code has to be in the worksheetmodule rather then in a standard module. Otherwise you will also have to refer to the worksheet the label is on.
e.g.Please Login or Register to view this content.
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
The label is located on the worksheet and the code is in a module for the workbook. The label is from the Forms.
I tried to refer to the worksheet as well (Blad3.NameLabel1.Caption = "hello") but then I get "Compile Error - Method or data member not found"
I'm starting to think there is something wrong with the label itself, as far as I can see it's called "NameLabel1"
2017-08-15 10_01_02-track.xlsm - Excel.jpg
Last edited by johandenver; 08-15-2017 at 04:04 AM.
Try this.
Please Login or Register to view this content.
Thanks, that worked perfectly.
Like this.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks