Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    VBA Flow (xl2002)

    In the following snippet of code, If the "First Test" turns off Page(11), because testarea is less than 35, then the "Second Test" should be skipped. If the "First Test" turns Page(11) on, because testarea is greater than 35, then the "Second Test" would need to be evaluated. In the first instance, how do I make the code skip over the second test...

    What do I need to add to my code to make it flow properly?

    <pre>
    Private Sub UserForm_Initialize()
    MultiPage1.Value = 0

    <font color=blue>'First Test </font color=blue>
    If Application.WorksheetFunction.Count(Sheets("DB1"). Range("testarea")) < 35 Then _
    MultiPage1.Pages(11).Enabled = False

    <font color=blue>'Second Test </font color=blue>
    If Range("trickyone") = 0 Then _
    MultiPage1.Pages(11).Enabled = False

    Application.ScreenUpdating = False
    ... </pre>

    - Ricky

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: VBA Flow (xl2002)

    Ricky,

    Use nested IFs and make a test for >= 35 first as follows :

    If Application.WorksheetFunction.Count(Sheets("DB1"). Range("testarea")) >= 35 Then
    MultiPage1.Pages(11).Enabled = True
    If Range("trickyone") = 0 Then _
    MultiPage1.Pages(11).Enabled = False
    End If
    Else
    MultiPage1.Pages(11).Enabled = False
    End If

    Andrew

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Flow (xl2002)

    Since your "First Test" never turns Page(11) on, it is not clear exactly what you want to do. If I understand it correctly, then this may be it:

    <pre>Private Sub UserForm_Initialize()
    MultiPage1.Value = 0
    If (Application.WorksheetFunction.Count(Sheets("DB1") .Range("testarea")) < 35) Or _
    (Range("trickyone") = 0) Then
    MultiPage1.Pages(11).Enabled = False
    Else
    MultiPage1.Pages(11).Enabled = True
    End If
    Application.ScreenUpdating = False
    </pre>

    Legare Coleman

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Thanks

    Thanks Andrew and Legare -

    It's working just as I needed. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    - Ricky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •