I have the following problem. I have a userform with entry fields. The user is going to enter a number for participants. I have four groups of participants:
Group A: 5 Group B: 6 Group C: 1 Group D: 2
Each participant should be named like this: {GA1, GA2, ..., GD2} I wanted to write this into an array in that order and then use this array to fill cells with the names but all I came up with were four for-loops to write it into the array and that failed too. Is there a better way to do this?
Dim GA As Integer
Dim GB As Integer
Dim GC As Integer
Dim GD As Integer
Dim PartSum As Integer
GA = TextBox32.Value
GB = TextBox33.Value
GC = TextBox34.Value
GD = TextBox35.Value
PartSum = GA + GB + GC + GD
Dim NamingArray() As String
ReDim NamingArray(1 To PartSum)
For i = 0 To GA
NamingArray(i) = "GA " & CStr(i)
Next i
For j = GA To GA + GB
NamingArray(i) = "GB " & CStr(j)
Next j
For k = GA + GB To GA + GB + GC
NamingArray(i) = "GC " & CStr(k)
Next k
For l = GA + GB + GC To GA + GB + GC + GD
NamingArray(i) = "GD " & CStr(l)
Next l
'check entries
For i = LBound(NamingArray) To UBound(NamingArray)
MsgBox (NamingArray(i))
Next i