Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add Formula To Label Control on UserForm

Posted on 2014-02-02
9
Medium Priority
?
1,444 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
Independent Software Vendors: 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 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

722 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