Results 1 to 10 of 10

IF and Else IF , Is there a better way to code this ?

Threaded View

  1. #10
    Forum Contributor
    Join Date
    01-06-2019
    Location
    Australia
    MS-Off Ver
    2019
    Posts
    209

    Re: IF and Else IF , Is there a better way to code this ?

    I have uploaded a sample file. It just doesn't have the userform. the userform will be the if statement as it has a multi page tab as 1 of the parts to the if statement and then a combo box for the other part both have to equal the values selected.

    As i would not like ot just copy and paste the code for each if, then , elseif of each multi page tab and combo box configuration.

    There are 6 multipages and the comboxbox would have 6 configurations (All,Half,Other Half,) for example

    Hope this helps

    It is basically i want this code in a multiple functions called by a sub that can call the correct function, depending on the multi page tab and combo box. With the functions i would like to change the amount of odd to even numbers picked ratio. So there would be multiple functions for example
    (3 ODD 3 Even), or (4 Odd 2 Even). If i can have 1 array of 6 or 7 and do it in 1 array that would be better. I couldn't see how that part could be done so that is why i split it int o2 parts 1 for Odd and 1 to deal with Even.

     NumArr.Clear
                j = 1
                Do Until j > 3
                   Set cell = RdmCell(rng)
                   ' Consider only ODD numbers
                   If cell.Value Mod 2 = 1 Then ' this changes for odd and even 
                      If Not cell.Value = "" And Not NumArr.contains(cell.Value) Then
                         NumArr.Add cell.Value
                         j = j + 1
                      End If
                   End If
    Thank you for your help
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1