Solved

Add Formula To Label Control on UserForm

Posted on 2014-02-02
9
1,099 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
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
 
LVL 1

Author Comment

by:Geekamo
ID: 39827560
@ Graham,

Could you revise that formula to reference a named cell instead?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 48

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now