+ Reply to Thread
Results 1 to 4 of 4

Loop through a userform listbox & copy certain columns into txtboxes on userform loop next

  1. #1
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Unhappy Loop through a userform listbox & copy certain columns into txtboxes on userform loop next

    Hi I need to run 5 reports for each account. Instead of running all 5 individually I want to run them through a Loop so run all on a click. I have a listbox on a userform that lists all the reports that need to be run. I have 4 text boxes to select certain columns in each row as it loops through. - the reports are based on what is in these text boxes.


    The Listboxis called: lstPortfolioRDM
    Userform is called: frmMenu

    The Text-boxes on the Userform I want to auto fill in the Loop are
    txtA- ListIndex, 4
    txtB- ListIndex, 3
    txtC - ListIndex, 2
    txtD - ListIndex, 5

    So basically, select the first record in the list, output certain column details into their allocated txtbox and then loop through the next.....and so on.


    I'm new to looping. The below looks through the list but only picks out the top row each time.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Loop through a userform listbox & copy certain columns into txtboxes on userform loop

    To start with don't increment a variable when that variable is being used as a counter in a loop.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Loop through a userform listbox & copy certain columns into txtboxes on userform loop

    Instead of using frmMenu.lstPortfolioRDM.ListIndex use n.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    Re: Loop through a userform listbox & copy certain columns into txtboxes on userform loop

    Thanks Norie and Cytop. I have it working now.

+ 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. Replies: 5
    Last Post: 11-16-2014, 11:04 AM
  2. [SOLVED] copy contents of userform listbox to another userform listbox
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2014, 11:39 AM
  3. HOW TO: Pause loop, fix error on a popup UserForm, continue loop
    By AndyMachin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-19-2014, 04:37 PM
  4. Transfer Data From One Userform Listbox to Another Userform Listbox with 11 columns
    By sparkoft in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2013, 10:54 AM
  5. Userform option button starts a loop that searches worksheet and populates listbox
    By silvertyphoon1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2010, 01:58 AM
  6. loop trough a userform listbox
    By GregJG in forum Excel General
    Replies: 2
    Last Post: 01-07-2009, 05:51 AM
  7. [SOLVED] Looping procedure calls userform; how to exit loop (via userform button)?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-27-2005, 08:05 AM

Tags for this Thread

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