+ Reply to Thread
Results 1 to 4 of 4

Thread: How to populate a label control using data from a spreadsheet

  1. #1
    Valued Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    561

    How to populate a label control using data from a spreadsheet

    I have a program that is used as a client login (electronic sign-in sheet). The opening screen is a UserForm where the client enters their ID #. On this screen I also have a Label control that displaces important information to the client. The information being displayed in the Label changes regularly. I would like for the employee that maintains the login program to be able to update the Label information without going into the VBA code. I have a tab labeled "Variables" which currently contains information that I use to populate several Combo Box controls. Is there a way to populate the text on the Label using one of the cells on the "Variables" tab?

    I thought this would be as simple as it is to populate the Combo Boxes, but so far I have not come up with the right code to do it. I have done several searches and have not found anything that has given me the answer I am needing. Any help will be greatly appreciated.
    Last edited by boylejob; 02-05-2012 at 11:31 PM.
    Sincerely,
    Jeff

  2. #2
    Valued Forum Contributor
    Join Date
    02-20-2007
    Location
    South Africa
    MS-Off Ver
    2007
    Posts
    488

    Re: How to populate a label control using data from a spreadsheet

    Hello boylejob,

    Is there a way to populate the text on the Label using one of the cells on the "Variables" tab?
    Yes. On your Sheet for variables, choose a cell,Say H12, which will populate the Label, and then use Code like the following sample:

    If Sheets("Variables").Range("H12") <> "" Then
    Userform1.Label2.Caption=Sheets("Variables").Range("H12").Value
    Else: Userform1.Label2.Caption = " Whatever you want it to display"
    End If
    Please consider:

    Be polite. Thank those who have helped you. Click the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Valued Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    561

    Re: How to populate a label control using data from a spreadsheet

    Winon,

    Thank you very much. That worked perfectly. I had something similar coded, but obviously had something out of place because it was not working.
    Sincerely,
    Jeff

  4. #4
    Valued Forum Contributor
    Join Date
    02-20-2007
    Location
    South Africa
    MS-Off Ver
    2007
    Posts
    488

    Re: How to populate a label control using data from a spreadsheet

    Hello boylejob,

    You are welcome.

    Please mark your thread as Solved.
    Please consider:

    Be polite. Thank those who have helped you. Click the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0