Results 1 to 7 of 7

How do I loop through combobox objects to add items?

Threaded View

bodhi808 How do I loop through... 03-27-2013, 09:17 AM
jaslake Re: How do I loop through... 03-27-2013, 10:18 AM
bodhi808 Re: How do I loop through... 03-27-2013, 10:52 AM
jaslake Re: How do I loop through... 03-27-2013, 11:09 AM
JosephP Re: How do I loop through... 03-27-2013, 11:31 AM
bodhi808 Re: How do I loop through... 03-27-2013, 06:57 PM
jaslake Re: How do I loop through... 03-27-2013, 07:19 PM
  1. #1
    Registered User
    Join Date
    01-28-2013
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010
    Posts
    50

    How do I loop through combobox objects to add items?

    Hi

    I'm a pretty basic user of VBA and am struggling with the method of looping through objects to make changes.

    I have 12 comboboxes on a userform which I have set to dropdown list and want to populate during the userform initialization.
    Each combobox is called "pt*" where * is a number from 1 - 12.
    I have currently set up my code with 12 lines, one for each combobox to apply the same dropdown list to each of the 12 boxes.
    ie

     pt1.rowsource = ptsource
    (where ptsource contains a range reference on the worksheet)

    I'm interested to learn how to improve my code to loop through 1-12 and apply the rowsource to each combobox.

    I did search through some past questions but could only come up with a method which seemed to step through every combobox on a worksheet rather than userform and in my case, I have two other comboboxes on the userform which I do not want to add this rowsource to, only the "pt*" named comboboxes.

    Would really appreciate some help to understand how to do this as I'm interested to keep improving any code I write.

    Many thanks
    Chris
    Last edited by bodhi808; 03-27-2013 at 11:15 AM.

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