+ Reply to Thread
Results 1 to 3 of 3

Passing arguments to userforms

  1. #1
    Steve
    Guest

    Passing arguments to userforms

    Hi

    I seem to have fixed one problem, only to find another.

    I have a workbook with several worksheets.

    On a main tab I have a button that loads a form and shows a list (in a
    listbox) of all the tabs in the workbook.

    I then want to select the tab from the list and then use that value as an
    argument to then bring up another list of all the column headers in the
    selected tab.

    I was kind of hoping it was as simple as "load List(TabName)" but wasn't to
    be.

    Suggestions much appreciated.
    --
    Steve R

  2. #2
    Tom Ogilvy
    Guest

    RE: Passing arguments to userforms

    Private Sub Listbox1_click()
    Dim sh as Worksheet, rng as Range
    Dim cell as Range
    if listbox1.listIndex <> -1 then
    listbox2.clear
    set sh = Worksheets(Listbox1.Value)
    set rng = sh.Range(sh.Cells(1,1),sh.Cells(1,"IV").end(xltoLeft))
    for each cell in rng
    listbox2.AddItem cell.Value
    next
    end if
    End sub

    --
    Regards,
    Tom Ogilvy


    "Steve" wrote:

    > Hi
    >
    > I seem to have fixed one problem, only to find another.
    >
    > I have a workbook with several worksheets.
    >
    > On a main tab I have a button that loads a form and shows a list (in a
    > listbox) of all the tabs in the workbook.
    >
    > I then want to select the tab from the list and then use that value as an
    > argument to then bring up another list of all the column headers in the
    > selected tab.
    >
    > I was kind of hoping it was as simple as "load List(TabName)" but wasn't to
    > be.
    >
    > Suggestions much appreciated.
    > --
    > Steve R


  3. #3
    Steve
    Guest

    RE: Passing arguments to userforms

    Tom

    Not what I had in mind but this is much better.

    Thank you so much
    --
    Steve R


    "Steve" wrote:

    > Hi
    >
    > I seem to have fixed one problem, only to find another.
    >
    > I have a workbook with several worksheets.
    >
    > On a main tab I have a button that loads a form and shows a list (in a
    > listbox) of all the tabs in the workbook.
    >
    > I then want to select the tab from the list and then use that value as an
    > argument to then bring up another list of all the column headers in the
    > selected tab.
    >
    > I was kind of hoping it was as simple as "load List(TabName)" but wasn't to
    > be.
    >
    > Suggestions much appreciated.
    > --
    > Steve R


+ 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