We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Excel user form label caption based on a cell value

Medium Priority
1,557 Views
Last Modified: 2013-11-25
How do I get an Excel user form label caption to be based on the value of a cell in a particular worksheet?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008

Commented:
You have to move the value. In the form's load routine:

   lblMyLabel = Sheets("Sheet1").[A1]

Kevin
Sandra SmithRetired

Author

Commented:
Kevin, thanks, I'll try that.  Be right back.
Sandra SmithRetired

Author

Commented:
I keep getting a Subsrcript Out of Range error.
Sandra SmithRetired

Author

Commented:
By the way, where is the "Load" event for a form?  I could not see it in the drop-down for event procedures.
CERTIFIED EXPERT
Top Expert 2008
Commented:
There are two associated with "loading": Initialize and Activate. Initialize is called when the form is first loaded. Activate is called whenever the form is activated from an inactive state.

The subscript error is cause because you don't have a tab named "Sheet1". Change "Sheet1" to the tab name with the source cell.

Kevin

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Sandra SmithRetired

Author

Commented:
OK, let me try that.  I thought I had changed the tab name, but I would be wrong.  Be back.
Sandra SmithRetired

Author

Commented:
Finally, got it!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.