+ Reply to Thread
Results 1 to 7 of 7

Need select a sheet in listbox when userform initialized

  1. #1
    Registered User
    Join Date
    06-24-2009
    Location
    Maldives
    MS-Off Ver
    MS 365 Subscription, v.2308
    Posts
    18

    Need select a sheet in listbox when userform initialized

    Hi,
    I want to select a sheet when userform initialized in the listbox items. The listbox works fine but i cannot figure out how to select on item when form load.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    261

    Re: Need select a sheet in listbox when userform initialized

    Do you want this?
    Please Login or Register  to view this content.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,356

    Re: Need select a sheet in listbox when userform initialized

    What will be the criteria to select an certain sheet?
    It will have to do with setting Listindex as hungt already showed but based on what?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    06-24-2009
    Location
    Maldives
    MS-Off Ver
    MS 365 Subscription, v.2308
    Posts
    18

    Re: Need select a sheet in listbox when userform initialized

    Yes, you are right, that's what i want. Changing the value can select any sheet.
    Thank you.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,356

    Re: Need select a sheet in listbox when userform initialized

    OK but how are you going to tell the code which value to set? Does it change everytime you open the userform or will it always be a fixed item or .....

  6. #6
    Registered User
    Join Date
    06-24-2009
    Location
    Maldives
    MS-Off Ver
    MS 365 Subscription, v.2308
    Posts
    18

    Re: Need select a sheet in listbox when userform initialized

    No, the code is related some other codes, so i can change it later from that code, initially i want select for the first sheet.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,356

    Re: Need select a sheet in listbox when userform initialized

    OK, then the code provided by hungt will do.
    Good luck with your project and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select UserForm ListBox value from matching value
    By peejayjay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2017, 06:29 AM
  2. [SOLVED] if anything in listbox select first item, if listbox empty do nothing (listbox in userform
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2015, 12:49 PM
  3. Is it possible to pre-select an item in a ListBox in a Userform?
    By bananajelly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2014, 02:14 PM
  4. Select Cells from Listbox on Userform
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2011, 08:35 AM
  5. [SOLVED] Checking a userForm that has not been initialized
    By Arne Hegefors in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-02-2006, 09:50 AM
  6. How does Userform get initialized by this?
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2005, 01:50 PM
  7. Userform runs other subs when initialized
    By zipdog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2005, 12:06 PM

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