+ Reply to Thread
Results 1 to 7 of 7

How to populate Listbox with last 5 rows of data

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    How to populate Listbox with last 5 rows of data

    Hi guys

    I have done a bit of a search and not found quite what I am looking for, This may be simple for some of you I hope, What I am trying to do is populate a userform listbox with the last 5 rows of data from column A, The list of data in column A is always changing (Can be 10 rows, 30 rows, 100 rows) So I am just trying to pull the last 5 rows and add them to a listbox, any help would be appreciated

    Example: Column A contained a list of numbers 1-23 then the listbox would populate....

    19
    20
    21
    22
    23

    Column A contained a list of numbers 1-35 then the listbox would populate....

    31
    32
    33
    34
    35

    Seems easy but I am struggling
    Kinds regards
    John

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to populate Listbox with last 5 rows of data

    Assuming ListBox1(name of control) and Sheet1(sheet name)
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: How to populate Listbox with last 5 rows of data

    Works great, thank you very much

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to populate Listbox with last 5 rows of data

    You are welcome and thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: How to populate Listbox with last 5 rows of data

    jindon

    Is there any way to stop the error when there are LESS than 5 items in column A ? works great but obviously its trying to add the last 5 rows when there are only 4 ?

    Regards
    John

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to populate Listbox with last 5 rows of data

    Change to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: How to populate Listbox with last 5 rows of data

    Thank you, solved

+ 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. trying to populate a listbox with rows from sheet then when selected split into textbox
    By justlearning123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2015, 06:45 AM
  2. Populate a listbox with data that is shared in two other listboxes
    By travreed7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2015, 03:25 AM
  3. Populate data in 2 column listbox using vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2014, 04:49 AM
  4. [SOLVED] Listbox in userform to populate with all rows containing the Date today AND 2 weeks prior
    By cath1509 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2013, 08:50 PM
  5. Populate data in listbox in a form
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2012, 09:42 AM
  6. [SOLVED] Populate row with data from ListBox
    By plank in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2012, 04:13 AM
  7. Populate listbox from 2 rows of cells
    By mikewild2000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2005, 09:46 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