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
(where ptsource contains a range reference on the worksheet)![]()
pt1.rowsource = ptsource
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
Bookmarks