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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
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
 

colinitaylor

Board Regular
Joined
Sep 22, 2004
Messages
62
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?
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,303
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

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")
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219

ADVERTISEMENT

: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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,303
Office Version
  1. 365
Platform
  1. Windows
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:
 

colinitaylor

Board Regular
Joined
Sep 22, 2004
Messages
62
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?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,303
Office Version
  1. 365
Platform
  1. Windows
What problem are you having?

Where/when are you running that code?
 

Forum statistics

Threads
1,141,017
Messages
5,703,752
Members
421,313
Latest member
Mooncake1

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
Top