OSUBuckeye20
New Member
- Joined
- Jun 11, 2019
- Messages
- 4
I have an issue with my UserForm that I have researched extensively and can't quite find the solution. I have a multipage UserForm with a page for each of my 8 events we'll be attending for my work. A few of the ComboBoxes and Listboxes should be populated with identical information and I'm trying to use a loop to do so. For example, the naming convention of one of the listboxes is "lstMarketingMenuX" where X equals numbers 1 through 8 corresponding to the correct event. Here's what I've tried to do so far but I get runtime errors:
The row source of "Marketing_Menu" is a named range on the current sheet. I want to use the same row source for each of the listboxes. Also, I want the listbox source to be assigned at runtime so I currently have a call to this sub in my initialize event. If you could shed some light on this I would greatly appreciate it!!!
Thanks,
Mike
Code:
Sub AssignMarketingMenu()
[LIST]
[*]Dim x as integer
[*] For x = 1 To 8 'for events 1 - 8
[*] With Me.Controls("lstMarketingMenu" & x) 'assign looped variable to listbox name
[*] .RowSource = "Marketing_Menu" 'loop through listbox and assign row source
[*] End With
[*] Next x
[*]End Sub
[/LIST]
The row source of "Marketing_Menu" is a named range on the current sheet. I want to use the same row source for each of the listboxes. Also, I want the listbox source to be assigned at runtime so I currently have a call to this sub in my initialize event. If you could shed some light on this I would greatly appreciate it!!!
Thanks,
Mike