Im working with a workbook with many sheets and im using a UserForm with more than 150 Combobox and arround 200 Labels.
I want to set the charasteristic and design of the comboboxes in only one and i want to be applied in a lot of them, so i do not want to repeat the code hundreds of times.
How should i do? i ve been reading but i cant match the examples with mine.
This is the wrong code:
Private Sub ComboBox7_Change()
Dim ws2 As Worksheet: Set ws2 = Sheets("C. VfM Questionnaire ")
Dim i, p As Integer
For i = 7 To 31
If Controls("ComboBox" & i).Value = "Yes" Then
ws2.Range("G7") = 4
Me.Controls("Label" & i).BackColor = RGB(146, 208, 80)
ElseIf Controls("ComboBox" & i).Value = "No" Then
ws2.Range("G7") = 4
Me.Controls("Label" & i).BackColor = RGB(255, 33, 26)
ElseIf Controls("ComboBox" & i).Value = "Not Applicable" Then
ws2.Range("G7") = 4
Me.Controls("Label" & i).BackColor = RGB(255, 204, 0)
End If
Next i
End Sub
Also i do not know how to trigger the code? is it in te user form initalize or in a module? Im so newbee as you can see!
Thanks a lot in advance.