Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop through pages in multipage control
I have a line of code which hides pages in a multipage control:
If pg.Index < SomeVariable Then pg.Visible = False End If I now want to replace SomeVariable with an ArrayOfVariables. There will be two variables in the array - say 1 and 2. However the code below does not work as the page which survives the first loop gets axed during the second loop. What do I need to do to preserve the page that is retained in earlier iterations of the loop. I almost need to pass all true tests in another array. Private Function PageRetain() Dim X As Integer For X = 0 To UBound(ListItemArray) ' this equals 1 For Each pg In UserForm1.MultiPage1.Pages If pg.Index < ListItemArray(X) - 1 Then ' this array has 2 elements: 1, 2 pg.Visible = False End If Next Next End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop through pages in multipage control
It seems like you should make the inner loop the outer one (and vice-
versa) and set pg.Visible = False before the inner loop and change it to True if pg.Index = ListItemArray(X) - 1 Hth, Merjet |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop through pages in multipage control
Yup that did it. Thanks - could not for the life of think outside of the
code I had already written. Thanks again. EM "merjet" wrote: It seems like you should make the inner loop the outer one (and vice- versa) and set pg.Visible = False before the inner loop and change it to True if pg.Index = ListItemArray(X) - 1 Hth, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to switch pages in a multipage control by a commandbutton | Excel Programming | |||
Multipage Control Pages - Changing Index Value in Code | Excel Programming | |||
Multipage Control Pages - Changing Index Value in Code | Excel Programming | |||
Set Focus Problem for textbox control on multipage control | Excel Programming | |||
Displaying different pages in MultiPage | Excel Programming |