+ Reply to Thread
Results 1 to 30 of 30

Loop through names of buttons on a userform

Hybrid View

  1. #1
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loop through names of buttons on a userform

    in your Ind2 form replace the label and textbox with a listbox (LIstbox1) and change the code to
    Private Sub CBNames_Change()
        Dim lRw As Long
        Dim iX As Long
        Dim wsMain As Worksheet
        Set wsMain = Sheets("Main")
        lRw = Me.CBNames.ListIndex + 2    '<-add 2 to allow for header row & ListIndex starts at zero
            For iX = 1 To wsMain.UsedRange.Columns.Count
                With Me.ListBox1
                    .AddItem wsMain.Cells(1, iX).Value
                    .List(.ListCount - 1, 1) = wsMain.Cells(lRw, iX).Value
                End With
            Next iX
    End Sub
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  2. #2
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Loop through names of buttons on a userform

    Thanks Joseph I see what you mean that is a lot easier and looks much better. The only thing is I need to also have the list show the dates the training was completed along side the list and then have some way to print the whole lot out. I really appreciate your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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