+ Reply to Thread
Results 1 to 2 of 2

UserForm howto?

  1. #1
    Registered User
    Join Date
    01-28-2005
    Posts
    70

    UserForm howto?

    Task: I need to write a macro that grabs a particular Range and generate a userform with a combobox.

    Description:
    Sheet1 contains names in cells D4:D34
    Sheet2 has an action button which when clicked needs to:
    - read the names in the afore mentioned range
    - generate a pop-up userform that contains the list of names
    in a combo box

    From there, the user picks a name and hits an Okay (or other button) which will then use their selection to perform some action.

    I've been reading up on creating userforms, but I'm having a hard time trying to figure out how to create something based on fluid data.

  2. #2
    Rick Hansen
    Guest

    Re: UserForm howto?

    Hello AMK4,

    There is several ways to attack you problem. But propably the easiest way.
    First Insert a UserForm, from VB Editor. Then on the UserForm place
    Combobox or or ListBox. In my example I use a ComboBox and name it
    'cbox_Name'. Also add the CommandButton to the UserForm. Now place the
    following code under the "UserForm_Initialize()" event. This code load
    comboBox with the names on Sheet1, cells D4:D34. This event is execute
    prior to showing the UserForm. I hope this gives you a starting point. For
    your UserForm...

    Rick, freezen in Alaska




    Private Sub UserForm_Initialize()
    Dim ws1 As Worksheet
    Dim x As Integer

    Set ws1 = Worksheets("Sheet1")

    Me.cbox_Name.Clear
    Me.cbox_Name.RowSource = ""

    For x = 4 To 34
    Me.cbox_Name.AddItem ws1.Cells(x, "D").Value
    Next x


    End Sub


    "AMK4" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Task: I need to write a macro that grabs a particular Range and generate
    > a userform with a combobox.
    >
    > Description:
    > Sheet1 contains names in cells D4:D34
    > Sheet2 has an action button which when clicked needs to:
    > - read the names in the afore mentioned range
    > - generate a pop-up userform that contains the list of names
    > in a combo box
    >
    > From there, the user picks a name and hits an Okay (or other button)
    > which will then use their selection to perform some action.
    >
    > I've been reading up on creating userforms, but I'm having a hard time
    > trying to figure out how to create something based on fluid data.
    >
    >
    > --
    > AMK4
    > ------------------------------------------------------------------------
    > AMK4's Profile:

    http://www.excelforum.com/member.php...o&userid=19143
    > View this thread: http://www.excelforum.com/showthread...hreadid=506121
    >




+ 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