Solved

Add Formula To Label Control on UserForm

Posted on 2014-02-02
9
1,245 Views
Last Modified: 2014-02-02
Hello Experts,

I have a UserForm, that will eventually become a "popup" window that is splashed on the screen when the user opens the Excel Workbook.

I have added a "Label" control onto my UserForm, and I would like it to display the result of this formula:

="Version - "&LOOKUP(90000000000,'Change Log'!A:A)&" (Jay Burke)"

I tried adding the formula right into the Label control, and it just shows the formula itself - not the result.  So either, I need to do something else? Or it's just not something that is supported?

Thank you in advance for your help!

~ Geekamo
0
Comment
Question by:Geekamo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39827499
Try

evaluate(="Version - "&LOOKUP(90000000000,'Change Log'!A:A)&" (Jay Burke)")
0
 
LVL 1

Author Comment

by:Geekamo
ID: 39827500
Nope, doesn't work.  It still just shows the formula.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39827528
You could set the caption to the value of the cell that has the formula.
Private Sub UserForm_Activate()
    Label1.Caption = Sheets(5).Range("C3").Value
End Sub

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Geekamo
ID: 39827560
@ Graham,

Could you revise that formula to reference a named cell instead?
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 39827568
and to paraphrase Syed

Label1 = "Version - " & Evaluate("=LOOKUP(90000000000,'Macro'!A:A)") & " (Jay Burke)"

Regards
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39827574
Just plug the name into the code
Private Sub UserForm_Activate()
    Label1.Caption = Sheets(5).Range("MyCell").Value
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:Geekamo
ID: 39827602
I'm not having any luck...

Can someone post a workbook that has a userform, and a label control is looking at a specific cell for it's value?

Hopefully that will help me out.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 39827664
Here is an example
Book1.xlsm
0
 
LVL 1

Author Comment

by:Geekamo
ID: 39827761
@ GrahamSkan,

So weird, I couldn't figure out what I was doing wrong.  Your version looked the same as mine - except I was referencing other names.

Anyhow, I copied and pasted yours - changed the names to this:

Private Sub UserForm_Activate()
    'Label1.Caption = Sheets(5).Range("C3")
    lblVersion.Caption = Range("Version")
End Sub

Open in new window


On your example that was referencing the named cell, I was wondering why it still needed to reference the sheet name.  So on a hunch, I just removed it - and it's working perfectly.

Thank you very much for taking the time to help me with this!

~ Geekamo
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question