Is there a way to change the index of a multipage to start at a number other than zero?

  • Hello!

    I'm wondering if there is a way to change the index of a multipage to start at a number other than zero. For example, I can run a loop through text boxes I have on the my first page so that I can hide the page if a certain text box is empty. Example code:

    For i = 0 To 6
    If Me.Controls("Txt_DateNew" & i).Value = "" Then
    Me.MultiPage4.Pages(i).Visible = False
    End If
    Next i

    I'd like to start the index of my second page at 7 so I can continue looping through all pages on the user form, but unfortunately I can't manually change the index to start at 7.

    I appreciate any help!


  • It looks like you could just use something like:

    Me.MultiPage4.Pages(Int(i/7)).Visible = False

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • It's fixed at zero. Why is this necessary?

    This is what I'm trying to avoid:

    I figured that If I could get the page index to start at the same number as the text box number then I could loop through the code quickly rather than having to copy and paste it.

  • If the TextBoxes all have the same naming style and start at 7 then this should work. Change the range of numbers.

    Sub x()
    Dim iX As Integer
    For iX = 7 To 10
    Me.MultiPage5.Pages(iX - 7).Visible = Me(Txt_DateNew & iX).Value = Empty
    Next iX
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!