Populate a label caption from a cell reference

colinitaylor

Board Regular
Joined
Sep 22, 2004
Messages
62
Im really new to VBA and was wondering if it is possible for a label caption to be linked to a referenced cell?

All advice appreciated
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Not sure if this is what you are after but,
If you have a text box (label) select it, then go to the formula bar enter a formula referencing the cell.
ie: =A7

Then anything you type.... goes into the text box.

Hope this helps,
Michael
 
Upvote 0
Thanks Michael, not too sure what you mean. I am creating a userform and think I should either be writing some code or modifying a property?
 
Upvote 0
Right click on the label in your user form.
You will see properties, click it.
In the long list of properties, find ControlSource.

Then enter in the box to the right =A7 or
whatever your cell reference is

Michael
 
Upvote 0
There is no property to modify to use a range for the caption of a label.

You need code, perhaps something like this.

Code:
Label1.Caption = Range("A7")
 
Upvote 0
:oops: :oops: :oops:
My bad I was doing it for a text box!!
NOrie why would I even attempt to challenge you... :LOL: :LOL: :LOL:

Michael
 
Upvote 0
Michael

I can't find a ControlSource property for a Label control either on a userform or from the ControlToolbox.:eek:

Mind you my system is pretty ancient. :rolleyes:
 
Upvote 0
Thanks Norie I was thinking along those lines. Still cant get it to work. Am I doing something foolish?

Sub GetMatchFixtures()

Label1 = Range("Match1")

End Sub

With Match1 being a named cell?
 
Upvote 0
What problem are you having?

Where/when are you running that code?
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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