Populate listbox with sheet names and make selectable.

  • Hey guys, i need a point in the right direction please. I have a form with a listbox. Apon initializing i want the listbox to be populated with all the sheet names. I would then like to be able to select the sheet i want and click a command button to send my data to that sheet. Here is a sample description of my task.

    I open my first form and fill it in.
    I then select special job by clicking the command button.
    My form with the listbox now opens.
    "i would select the sheet that the special job is in and press the command button"
    All data from the first form is transfered to the selected sheet.

    The good news is i have already programmed the transfer code all i need is to populate the listbox and have it seletable.

    Also is there a way to not display the first 6 or 7 pages?

    Thanks in advance for any ideas.

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Populate listbox with sheet names and make selectable.


    You could put this in the userform's code module

    The intialize routine fill the listbox with the sheets' names (except for the explicitly ExcludedSheets)
    You transfer routine would use the SelecteSheet function to specify the destination sheet for the data. Note: selectedSheet might be Nothing if no selection is made.

  • Re: Populate listbox with sheet names and make selectable.


    i am trying it now.

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Populate listbox with sheet names and make selectable.


    It will only hide 1 sheet

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Populate listbox with sheet names and make selectable.


    Scratch that last one, i figured it out.

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Populate listbox with sheet names and make selectable.


    Im not sure how you implimented the last bit of code. How will that transfer my data? How do i use it?

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Populate listbox with sheet names and make selectable.


    The selecteSheet function will not transfer anything. It will return the Worksheet object selected by the user. It is a tool that your existing transfer code. It would be used somewhat like


  • Re: Populate listbox with sheet names and make selectable.


    Thanks Mic i got it going! Your awesome!!

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!