Solved

Add Formula To Label Control on UserForm

Posted on 2014-02-02
9
1,349 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Author Comment

by:Geekamo
ID: 39827560
@ Graham,

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

630 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