callen2468
07-26-2007, 08:13 AM
I am having trouble with a For Each Next loop. In brief, I have a Userform with 27+ combo boxes. Each CB's rowsource is dependent upon the previous CB's selection. For this reason I enable the CB's one at a time as the user progresses through the form. Using CB change events I control the enabling of the next CB and Label and the CB's rowsource.
Problem: A user can get to CB10 and may decide to go back and change CB3. This results in the need to clear CB4 - CB10. Currently, I am using individual lines of code to enable all succeeding CB's, set their values to "", then disable the CB's and their labels. (Muchas lineas de codigo).
I want each change event to include a loop that disables all succeeding CB's. In other words, when CB3 changes CB4 -CB27 will disable...when CB17 changes CB18-CB27 will disable.
I was able to write a For Each Next loop to diable all of the CB's and labels in my initialize sub but I can't seem to get the limited loop written correctly. Can someone give me a nudge in the right direction?
Thanks,
Chris
Problem: A user can get to CB10 and may decide to go back and change CB3. This results in the need to clear CB4 - CB10. Currently, I am using individual lines of code to enable all succeeding CB's, set their values to "", then disable the CB's and their labels. (Muchas lineas de codigo).
I want each change event to include a loop that disables all succeeding CB's. In other words, when CB3 changes CB4 -CB27 will disable...when CB17 changes CB18-CB27 will disable.
I was able to write a For Each Next loop to diable all of the CB's and labels in my initialize sub but I can't seem to get the limited loop written correctly. Can someone give me a nudge in the right direction?
Thanks,
Chris