+ Reply to Thread
Results 1 to 4 of 4

Userform listbox - Getting Sheet row of selected item

  1. #1
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Userform listbox - Getting Sheet row of selected item

    Hi all

    I have a list box with values from rows within a sheet.

    Is there anyway of getting the row number of which contained the original data from the sheet data source by selecting the item in the list box?

    Any ideas appreciated

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Userform listbox - Getting Sheet row of selected item

    Let's say your list data is stored in cells B5:B10, so you know up front the row number of the first item in the list box (ie. row 5).
    I'm not sure what listbox you're using, but in the forms control, i would calculate the corresponding row as required. So if you select the 3rd item in the listbox:
    Start row number + List1.ListIndex, so if you select the 3rd item in the listbox, you'd get 5 + 2 = 7 (ListIndex is base-zero)

  3. #3
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Userform listbox - Getting Sheet row of selected item

    Thanks

    I have filters in place so this will effect the listbox order to the row order on the worksheet

  4. #4
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Userform listbox - Getting Sheet row of selected item

    I can only find a way of getting the value of the listbox row.

    I need to look up the row that this would be on the sheet holding the data.

    With filters in place this method cant be used

+ 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. [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
  2. Selected item in first listbox.
    By waka in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-09-2015, 11:45 PM
  3. [SOLVED] Run 1 macro when any item from listbox is selected
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2014, 09:52 PM
  4. [SOLVED] Update (strikethrough) Listbox item selected within sheet
    By ShaunRoos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2014, 02:45 PM
  5. [SOLVED] listindex=0 when first item selected in a multiselect listbox on a userform?
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-17-2013, 12:38 PM
  6. Keep selected ListBox item highlighted when reopening userform
    By berlini in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2011, 08:38 AM
  7. How to copy selected listbox item to sheet
    By michdan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2005, 08:05 AM

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