+ Reply to Thread
Results 1 to 5 of 5

Workbook Open fill Listbox

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Workbook Open fill Listbox

    Is it possible to fill a listbox on workbook open?
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 08-27-2012 at 02:40 PM. Reason: Replaced quote tags with code tags

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Workbook Open fill Listbox

    zplugger,

    You almost had it:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Workbook Open fill Listbox

    Thanks again tigeravatar that help me with the problem I have. If I add to the code I get a error? hoping to have it open to first item in list.

    PHP Code: 
    Private Sub Workbook_Open()
    Sheet1.ListBox1.List = Sheet1.Range("test").Value
     ListBox1
    .Selected(0) = True
    End Sub 

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Workbook Open fill Listbox

    Please Login or Register  to view this content.
    Explaining a bit:
    The Workbook_Open event doesn't know what sheet you're on. So you have to explicitly tell it the sheet and object you're working with. That is why it needed Sheet1.Listbox1. Instead of writing that out 2 times for each line of code, you can just use the With statement until you're done with that object.
    Last edited by tigeravatar; 08-27-2012 at 12:42 PM. Reason: added explanation

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Workbook Open fill Listbox

    Thank You Works Perfect, another great job from this great forum

+ 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