Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If the .. multiple choice.... (2000)

    Suggestion... in VBA
    I use this code to set particular condition to find value...

    part of code:

    ....

    ANNO = Sheets("STAT_NEW_1").ComboBox3.Text
    FIDO_1 = Sheets("STAT_NEW_1").ComboBox4.Text
    DIVISA = Sheets("STAT_NEW_1").ComboBox5.Text


    If Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("G" & RIGA2) = FIDO_1 And WS1.Range("I" & RIGA2) = DIVISA Then

    'other code

    end if

    now i want to permit the user to choice only a value from the 3 combobox, for example to select only the year in this case the if statment is:

    If Right(WS1.Range("H" & RIGA2), 4) = ANNO Then
    end if

    but i want to permit the user to choice also 2 different combobox selection... ANNO and FIDO the next condition can be:

    If Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("G" & RIGA2) = FIDO_1 Then

    ecc....

    in effect i want to permit the user to choice one two or all condition...

    wath you suggest me????

    Make a multiple if the statement or have another way to use multiple selection???

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: If the .. multiple choice.... (2000)

    Something like?

    ANNO = Sheets("STAT_NEW_1").ComboBox3.Text
    FIDO_1 = Sheets("STAT_NEW_1").ComboBox4.Text
    DIVISA = Sheets("STAT_NEW_1").ComboBox5.Text

    If Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("G" & RIGA2) = FIDO_1 And WS1.Range("I" & RIGA2) = DIVISA Then
    'code for all true
    elseIf Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("G" & RIGA2) = FIDO_1 Then
    'Code for Only ANNO and FIDO
    elseIf Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("I" & RIGA2) = DIVISA Then
    'Code for only ANNO and DIVISA
    elseIf WS1.Range("G" & RIGA2) = FIDO_1 And WS1.Range("I" & RIGA2) = DIVISA Then
    'Code for only FIDO and DIVISA
    ElseIf Right(WS1.Range("H" & RIGA2), 4) = ANNO And WS1.Range("G" & RIGA2) = FIDO_1 And WS1.Range("I" & RIGA2) = DIVISA Then
    'Code for just ANNO
    ElseIf WS1.Range("G" & RIGA2) = FIDO_1 Then
    'Code for just FIDO
    ElseIf WS1.Range("I" & RIGA2) = DIVISA Then
    'Code for just DIVISA
    end if

    Steve

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If the .. multiple choice.... (2000)

    wow!!! work great.
    Tks for patience....

Posting Permissions

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