2 select case imbriqués

KGreg

XLDnaute Nouveau
salut à tous

voila mon souci.
J'ai 2 textbox qui correspondent à une codification.
Dans le premier textbox j'entre un code en lettre et dans l'autre en chiffre(ex:LIB 01)

J'ai une base de donnée dans laquelle je recherche l'un ou l'autre code pour qui me l'affiche dans une autre feuille. Séparément ca marche bien. Il m'affiche tous les produits avec l'un ou l'autre code. Mais je souhaite afficher les produits qui correspondent au code rentré.
ex: si je rentre LES dans le premier textbox et 01 dans le second je voudrais obtenir tous les produits correspondant à LES 01 et non pas les produits correspond à LES ou à 01.

Voila ce que j'ai:

Code:
 While Sheets('Liste FDS').Range('A' & Nligne_codification).Value <> ''
    Select Case Range('C' & Nligne_codification).Value
       Case Recherche_Préf.Value
            Sheets('Liste FDS').Range('A' & Nligne_codification & ':AZ' & _
                Nligne_codification).Copy Destination:=Sheets('Recherche').Range('A' & _
                Nligne_recherche)
            Nligne_recherche = Nligne_recherche + 1
           
            End Select
      Select Case Range('D' & Nligne_codification).Value
                Case Recherche_Num.Value
                    Sheets('Liste FDS').Range('A' & Nligne_codification & ':AZ' & _
                    Nligne_codification).Copy Destination:=Sheets('Recherche'). _
                    Range('A' & Nligne_recherche)
    Nligne_recherche = Nligne_recherche + 1
    End Select
    Nligne_codification = Nligne_codification + 1
    
    Wend

Voila je souhaite imbriqué les 2 select case pour afficher les produits qui correspondent au code rentré mais je sais pas comment faire.

Merci pour votre aide

Greg
 

Hellboy

XLDnaute Accro
Bonjour

Je ne suis pas sure que ça va être complet du prewmier coup, ça vaux la peine de l'essayer.

While Sheets('Liste FDS').Range('A' & Nligne_codification).Value <> ''
If (Range('C' & Nligne_codification).Value = Recherche_Préf.Value) And Range('D' & Nligne_codification).Value = Recherche_Num.Value Then
Sheets('Liste FDS').Range('A' & Nligne_codification & ':AZ' & _
Nligne_codification).Copy Destination:=Sheets('Recherche').Range('A' & Nligne_recherche)
Sheets('Liste FDS').Range('A' & Nligne_codification & ':AZ' & _
Nligne_codification).Copy Destination:=Sheets('Recherche'). _
Range('A' & Nligne_recherche)
Nligne_recherche = Nligne_recherche + 1
End If
Nligne_codification = Nligne_codification + 1
Wend

En passant, comment tu fait pour coller ton code afin qu'il soit si bien présenté ?

Philippe
 

Hellboy

XLDnaute Accro
ceci est un test:
Code:
Dim I As Integer
    Dim j As Integer
    Dim k As Integer
    Dim strName As String
    Dim Recipient() As String
    Dim ccRecipient() As String
    Dim strSendTo As String
    Dim strCopyTo As String
    Dim intCount As Integer
    Dim intCount2 As Integer
    Dim intPos As Integer
    'Récupération des nom déjà saisis...
    strSendTo = gstrSendTo
    strCopyTo = gstrCopyTo
    'SendTo
    intPos = InStr(strSendTo, gcListSep)
    I = 0
    ReDim Recipient(I) As String
    While intPos > 0
        ReDim Preserve Recipient(I) As String
        Recipient(I) = VBA.Left(strSendTo, intPos - 1)
        I = I + 1
        strSendTo = VBA.Mid(strSendTo, intPos + 1)
        intPos = InStr(strSendTo, gcListSep)
    Wend

fin du Test

Je viens de réaliser qu'il y a un utilitaire pour le collage du code. Petit coquin, ont ne dis pas tout !!!!!

Donne moi des nouvelles si ça marche


Philippe

:whistle:

Message édité par: Hellboy, à: 26/04/2005 13:49
 

Discussions similaires

Réponses
3
Affichages
568

Statistiques des forums

Discussions
312 092
Messages
2 085 218
Membres
102 826
dernier inscrit
ag amestan