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
 
I am running it from Module1 and get a runtime 424 error message

Sub GetMatchFixtures()

'This will populate the Fixtures in the userform
Label1.Caption = Range("Match1")

End Sub
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Why are you running it from there?

Any code to populate controls on a userform should probably be in the userform's Initialize event.
Code:
Private Sub UserForm_Initialize()
    Label1.Caption = Range("Match1")
End Sub
 
Upvote 0
Thanks Norie I am on the right tracks now. I think!

I was on an introduction to VBA course last week, I didn't really find it all that helpful so I am just attempting a mini project of my own with the assistance of the course notes, Excel VBA for dummies and of course some assistance from your good self
 
Upvote 0
Colin

I recall your previous post, I think something to do with ToggleButtons?

Where they mentioned/taught on the course at all?
 
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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