Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to switch pages in a multipage control by a commandbutton furbiuzzu Excel Programming 2 September 11th 06 03:16 PM
Multipage Control Pages - Changing Index Value in Code misseill Excel Programming 1 July 13th 05 04:55 PM
Multipage Control Pages - Changing Index Value in Code misseill Excel Programming 0 July 13th 05 04:32 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Displaying different pages in MultiPage Joepy Excel Programming 0 August 11th 03 01:03 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"