cannot set controlsource

dsaffo

Board Regular
Joined
Mar 16, 2006
Messages
111
Hi, I am trying to set a controlsource property so that when a cell on a worksheeet is changed, the label will also change. However, when I try to set the controlsource I get an error that says :

Could not set the ControlSource property. Invalid property value.

I've tried it with a label in the code,

lblUser.ControlSource = Worksheets("User List").Range("C1")

and I've tried it in the properties window of a textbox, and I cannot get either to work. I've also unprotected the sheet first, thinking that might have something to do with it. Any help would be appreciated.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
There is no ControlSource property for a Label.

Is this label on the spreadsheet, if so, is it from the Control Toolbox?
Or is it on a UserForm?
 
Upvote 0
It is on a userform. I tried it with a textbox as well, but it still will not let me enter it.
 
Upvote 0
Like HOTPEPPER said a label doesn't have a controlsource property.

And the controlsource property of a textbox expects a string.

The code you've posted would try to set the property to the value in Worksheets("User List").Range("C1").

Try this.
Code:
TextBox1.ControlSource = "'User List'!C1"
 
Upvote 0
Like HOTPEPPER said a label doesn't have a controlsource property.

And the controlsource property of a textbox expects a string.

The code you've posted would try to set the property to the value in Worksheets("User List").Range("C1").

Try this.
Code:
TextBox1.ControlSource = "'User List'!C1"

My code is similar but it doesn't work. My code is like this
Textbox1.controlSource = Worksheet("myworksheet").Range("G" & spinbutton1.Value)
I incorporate a spinbutton to move through the records

If I drop the .controsource it picks up the data fine but I can't update the values
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

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