A background to why im trying to do this. I am creating a program for work, this is one of many way of doing this process, where users select test that they have carried out, around 50 possible test using a userfom that ive made. From the selection it runs through each userform based off which checkboxes were ticked, without the need to choose another test.
i.e. if they select 1,2,5 then the program will evenutally load UserForm1 -> UserForm2 -> NOT UserForm3 -> NOT UserForm4 -> UseeForm5
The idea is that the user selects the options they want then based off the options selected create an arrey of either 0 if they didnt select the option or (1,2,3,4...) if they did, this number depends upon which checkbox was selected. i.e CheckBox1 = 1 CheckBox2 = 2 etc.
From this arrey I think i'll be able to select the correct userform using the .find feature in excel with a for loop.
But i have an issue when i run my code below,
Sub List_Create()
Dim tests(5) As Integer
If CheckBox1.Value = True Then
tests(0) = 1
Else: tests(0) = 0
End If
If CheckBox2.Value = True Then
tests(1) = 2
Else: tests(0) = 0
End If
If CheckBox3.Value = True Then
tests(2) = 3
Else: tests(0) = 0
End If
If CheckBox4.Value = True Then
tests(3) = 4
Else: tests(0) = 0
End If
If CheckBox5.Value = True Then
tests(4) = 5
Else: tests(0) = 0
End If
End Sub
I get a runtime 424 error, object required. Which when debugged is on the line If CheckBox1.Value = True Then
Where have i gone wrong with my code? Is this possible, im not sure if it is?
Hope this is all clear.
Thanks
Aucun commentaire:
Enregistrer un commentaire