1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Function getAllQuestions(categoryname As String, categoriesRange As Range) As Category
Dim i, j, k As Integer
i = 1
j = 1
k = 1
getAllQuestions = New Category
With getAllQuestions
Let getAllQuestions.name = categoryname
Let getAllQuestions.Questions = New Question
For Each currentCell In categoriesRange
If currentCell.Value = categoryname Then
j = 2
getAllQuestions.Questions(i) = New Question
With getAllQuestions.Question(i)
.label = Cells(currentCell.Row, j).Value
j = j + 1
While Cells(currentCell.Row, j).Value <> ""
Let getAllQuestions.Question(i).answer(k) = New answer
Let getAllQuestions.Question(i).answer(k).label = Cells(currentCell.Row, j).Value
j = j + 1
Let getAllQuestions.Question(i).answer(k).weight = Cells(currentCell.Row, j).Value
j = j + 1
k = k + 1
Wend
End With
End If
Next |
Partager