+ Reply to Thread
Results 1 to 3 of 3

VBA Looping with Labels on Userform

  1. #1
    Registered User
    Join Date
    09-10-2009
    Location
    Brighton,England
    MS-Off Ver
    Excel 2003
    Posts
    44

    VBA Looping with Labels on Userform

    Hi,

    I am hoping someone can help me out here.

    I have 53 Label captions on a userform. These pick up their value from cell on sheet 1.

    IE Label1.gets data from cell A1
    Label2 gets data from cell A2

    Is there a way to loop through to assign value to all 53 labels without having to code each one?

    If the cell from which the data is taken contains "NO DATA" the back color of the label needs to be set to grey.

    There must be a simple way to code this without have to write 106 lines of code.

    Any Help appreciated.

    Regards

    Mark.
    Last edited by msommerf; 02-25-2010 at 09:28 AM. Reason: solved

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: VBA Looping with Labels on Userform

    Hi Mark

    It isn't difficult if you have a nice consistent naming convention (which it appears you have):

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    09-10-2009
    Location
    Brighton,England
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: VBA Looping with Labels on Userform

    Many thanks Richard,

    Works a treat and saved me typing away for hours.

    Thanks again

    Mark.

+ 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.6.0 RC 1