WaqasTariq
Board Regular
- Joined
- Jun 26, 2012
- Messages
- 58
- Office Version
- 365
I have 6 listbox'es that are named "lb_RU_#" where # is the number of listbox. each listbox has 6 options. I want to find which items are selected in each listbox and save the value to an array.
This is how I can do one list box at a time:
How can I use two loops and be able to save the values for all 6 list boxes. I tried creating "Public lb_Test1 As ListBox" but I am not sure how to save to lb_Test1.
This is how I can do one list box at a time:
VBA Code:
Public i_SelectionCount1 As Integer
Public l_ForLoop1 As Long
Public s_Array_ReactorUnits() As String
ReDim s_Array_ReactorUnits(1 To 6, 1 To 6)
i_SelectionCount1 = 0
For l_ForLoop1 = 0 To WkS_Config.lb_RU_1.ListCount - 1
If WkS_Config.lb_RU_1.Selected(l_ForLoop1) = True Then
i_SelectionCount1 = i_SelectionCount1 + 1
s_Array_ReactorUnits(1, i_SelectionCount1) = WkS_Config.lb_RU_1.List(l_ForLoop1)
End If
Next
How can I use two loops and be able to save the values for all 6 list boxes. I tried creating "Public lb_Test1 As ListBox" but I am not sure how to save to lb_Test1.